帝國cms常用的SQL語句
  • 更新時(shí)間:2024-10-25 04:22:51
  • 建站經(jīng)驗(yàn)
  • 發(fā)布時(shí)間:1年前
  • 274

1.復(fù)制tags字段內(nèi)容到keyboard,當(dāng)keyboard為空的時(shí)候:

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字段內(nèi)容到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(相關(guān)鏈接)字段為空,說明keyboard設(shè)置不合理,干脆清空,為自動(dòng)分詞掃清障礙

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在副表,提取第一張圖片為標(biāo)題圖片。當(dāng)標(biāo)題圖片為空的時(shí)候。

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;

我們專注高端建站,小程序開發(fā)、軟件系統(tǒng)定制開發(fā)、BUG修復(fù)、物聯(lián)網(wǎng)開發(fā)、各類API接口對接開發(fā)等。十余年開發(fā)經(jīng)驗(yàn),每一個(gè)項(xiàng)目承諾做到滿意為止,多一次對比,一定讓您多一份收獲!

本文章出于推來客官網(wǎng),轉(zhuǎn)載請表明原文地址:https://www.tlkjt.com/experience/8100.html
推薦文章

在線客服

掃碼聯(lián)系客服

3985758

回到頂部