織夢cms常用的SQL語句_dedecms

小虎哥-技術部落格發表於2018-03-07

1、刪除所有註冊會員及會員資訊的SQL語句

DELETE FROM `#@__member` WHERE `#@__member`.`mid`!= 1;
TRUNCATE TABLE `#@__member_flink`; 
TRUNCATE TABLE `#@__member_person`; 
TRUNCATE TABLE `#@__member_space`; 
TRUNCATE TABLE `#@__member_tj`;

2、批量修改欄目為動態

UPDATE `#@__arctype` SET `isdefault` = \'-1\'

3、批量修改欄目為靜態

UPDATE `#@__arctype` SET `isdefault` = \'1\'

4、批量刪除所有文章

DELETE FROM #@__addonarticle WHERE aid>0;
DELETE FROM #@__arctiny WHERE id>0;
DELETE FROM #@__archives WHERE id>0;

5、將所有文件設定為僅動態

update #@__archives set ismake=-1;

6、將所有文件設定為僅靜態

update #@__archives set ismake=1;

7、批量刪除所有內容為空的文章

DELETE FROM #@__arctiny where id in(select aid from #@__addonarticle where body='');
DELETE FROM #@__archives where id in(select aid from #@__addonarticle where body='');
DELETE FROM #@__addonarticle where body='';

8、批量刪除所有標題為空的文章

DELETE FROM #@__addonarticle where aid in(select id from #@__archives where title='');
DELETE FROM #@__arctiny where id in(select id from #@__archives where title='');
DELETE FROM #@__archives where where title='';

9、批量稽核所有文章

Update `#@__arctiny` set arcrank='0' where arcrank='-1';
Update `#@__archives` set arcrank='0' where arcrank='-1';

10、批量刪除所有未稽核文章

DELETE FROM #@__addonarticle where aid in(select id from #@__arctiny where arcrank='-1');
DELETE FROM `#@__arctiny` where arcrank='-1';
DELETE FROM `#@__archives` where arcrank='-1';

相關文章