帝国CMS批量选新闻正文内容的第一张图片为标题缩略图的SQL语句
发布时间:2022-04-28 10:54:31 所属栏目:经验 来源:互联网
导读:执行以下脚本的时候请 先备份数据库!文本存放的新闻正文字段不可用! 新闻正文字段作为主表的情况用以下语句: update phome_ecms_news set titlepic =concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(newstext, src=, -1),.gif,1),,),.gif) where newstex
执行以下脚本的时候请 先备份数据库!文本存放的新闻正文字段不可用! 新闻正文字段作为主表的情况用以下语句: update phome_ecms_news set titlepic =concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(newstext, 'src=', -1),'.gif',1),'"',''),'.gif') where newstext like '%.gif%' and titlepic=''; update phome_ecms_news set titlepic =concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(newstext, 'src=', -1),'.jpg',1),'"',''),'.gif') where newstext like '%.jpg%' and titlepic=''; update phome_ecms_news set titlepic =concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(newstext, 'src=', -1),'.png',1),'"',''),'.png') where newstext like '%.png%' and titlepic=''; 新闻正文字段作为副表的情况用以下语句: update [!db.pre!]ecms_news_data_1 a, [!db.pre!]ecms_news b set b.titlepic=concat(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(a.newstext, 'src=', -1),'.gif',1),'"',''),'.gif') where a.newstext like '%.gif%' 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, 'src=', -1),'.jpg',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, 'src=', -1),'.png',1),'"',''),'.png') where a.newstext like '%.png%' and b.titlepic='' and a.id=b.id; (编辑:大同站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
站长推荐