KanColle © 2014 DMM.com / KADOKAWA GAMES All Rights Reserved. / Animation by © Good Smile Company
[Discuz]MySQL 取代文章內容字串語法
#1
如果想改某個字串,可以用下面的方法取代
程式碼:
update cdb_posts set message=replace(message,'[flash','[media=swf');
update cdb_posts set message=replace(message,'[/flash]','[/media]');
刪除所有回覆:
delete from cdb_posts where first=0

刪除ID1版塊的回覆:
delete from cdb_posts where fid =1 and first = 0;

刪除第6556個主題的所有回覆:
delete from cdb_posts where tid =6556 and first = 0


論壇ID23板塊裡所有回覆長度小於20的而且沒有附件的回覆全部刪除掉
delete from cdb_posts where length(message)<20 and attachment=0 and fid=23


一次性給一個貼內的所有回覆人加積分
update cdb_members set extcredits2=extcredits2+10 where uid in(SELECT authorid FROM `cdb_posts` WHERE tid=主題ID)
extcredits2 是需要增加的積分字段 , 使用的時候要注意增加的哪個積分字段


批次刪除ID23板塊裡的所有主題
delete from cdb_threads where fid=23


批次替換ID24板塊裡,所有回覆中指定的字元串
UPDATE cdb_posts SET message=REPLACE(message,'要替換的字元串','替換後的字元串') where fid=24

批次替換文章內容顯示頁標題字元 引用:
UPDATE cdb_posts SET subject=REPLACE(subject,'要替換的字元串','替換後的字元串');

批次替換文章標題字元
UPDATE cdb_threads SET subject=REPLACE(subject,'要替換的字元串','替換後的字元串');


批次在回覆的前後加入字元串1和字元串2
UPDATE cdb_posts SET message=CONCAT('字元串1',message,'字元串2') where fid=24
回覆


前往:


正在瀏覽這個主題的使用者: 1 位訪客