优晟SEO

您现在的位置是:首页 > CMS教程 > 帝国cms > 正文

帝国cms

帝国CMS常见常用的SQL语句

帝国   语句   常见  
佚名 2024-08-24帝国cms
帝国CMS常见常用的SQL语句有哪些,下面一起来看看吧:  一、复制tags字段内容到keyboard,当keyboard为空的时候:update[!db.pre!]ecms_news_data_1a,[!db.pre!]ecms_newsbsetb.keyboard=a.infotagswherea.id=b.idandb.key……

帝国CMS常见常用的SQL语句

帝国CMS常见常用的SQL语句有哪些,下面一起来看看吧:

  一、复制tags字段内容到keyboard,当keyboard为空的时候:

update[!db.pre!]ecms_news_data_1a,[!db.pre!]ecms_newsbsetb.keyboard=a.infotagswherea.id=b.idandb.keyboard='';

  二、添加tags字段内容到keyboard:

update[!db.pre!]ecms_news_data_1a,[!db.pre!]ecms_newsbsetb.keyboard=concat(b.keyboard,',',a.infotags)wherea.id=b.idandb.keyboard<>''anda.infotags<>'';

  三、如果副表中keyid(相关链接)字段为空,说明keyboard设置不合理,干脆清空,为自动分词扫清障碍

update[!db.pre!]ecms_news_data_1a,[!db.pre!]ecms_newsbsetb.keyboard=''wherea.id=b.idanda.keyid=''

  四、newstext在副表,提取第一张图片为标题图片。当标题图片为空的时候。

update[!db.pre!]ecms_news_data_1a,[!db.pre!]ecms_newsbsetb.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext,'.jpg',1),'src=',-1),'"',''),'.jpg')wherea.newstextlike'%.jpg%'andb.titlepic=''anda.id=b.id;update[!db.pre!]ecms_news_data_1a,[!db.pre!]ecms_newsbsetb.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext,'.gif',1),'src=',-1),'"',''),'.gif')wherea.newstextlike'%.gif%'andb.titlepic=''anda.id=b.id;