帝国cms常用的SQL语句
  • 更新时间:2024-09-20 17:36:55
  • 建站经验
  • 发布时间:1年前
  • 181

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

update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.keyboard=a.infotags where a.id=b.id and b.keyboard='';


2.添加tags字段内容到keyboard:

update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.keyboard=concat(b.keyboard,',',a.infotags) where a.id=b.id and b.keyboard<>'' and a.infotags<>'';


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

update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.keyboard='' where a.id=b.id and a.keyid=''


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

update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext, '.jpg', 1),'src=',-1),'"',''),'.jpg') where a.newstext like '%.jpg%' and b.titlepic='' and a.id=b.id;


update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext, '.gif', 1),'src=',-1),'"',''),'.gif') where a.newstext like '%.gif%' and b.titlepic='' and a.id=b.id;

我们专注高端建站,小程序开发、软件系统定制开发、BUG修复、物联网开发、各类API接口对接开发等。十余年开发经验,每一个项目承诺做到满意为止,多一次对比,一定让您多一份收获!

本文章出于推来客官网,转载请表明原文地址:https://www.tlkjt.com/experience/8100.html
推荐文章

在线客服

扫码联系客服

3985758

回到顶部