原文来自:https://www.zixuephp.com
dedecms中常用的数据表操作SQL语句
本文章总结了几乎所有常用的dedecms数据表中记录的操作sql语句,包括有删除,审核,批量修改等等.
删除所有注册会员,代码如下:
- DELETEFROM`detest_member`WHERE`detest_member`.`mid`!=1;
- TRUNCATETABLE`detest_member_flink`;
- TRUNCATETABLE`detest_member_person`;
批量修改栏目为动态,代码如下:
UPDATE `detest_arctype` SET `isdefault` = '-1'
批量删除文章,代码如下:
- DELETEFROMdetest_addonarticleWHEREaid>0;
- DELETEFROMdetest_arctinyWHEREid>0;
- DELETEFROMdetest_archivesWHEREid>0;
批量修改文章为动态显示,代码如下:
update detest_archives set ismake=-1;
批量修改文章为静态显示,代码如下:
update detest_archives set ismake=1;
批量删除所有内容为空文章,代码如下:
- DELETEFROMdetest_arctinywhereidin(selectaidfromdetest_addonarticlewherebody='');
- DELETEFROMdetest_archiveswhereidin(selectaidfromdetest_addonarticlewherebody='');
- DELETEFROMdetest_addonarticlewherebody='';
批量删除标题为空的文章,代码如下:
- DELETEFROMdetest_addonarticlewhereaidin(selectidfromdetest_archiveswheretitle='');
- DELETEFROMdetest_arctinywhereidin(selectidfromdetest_archiveswheretitle='');
- DELETEFROMdetest_archiveswherewheretitle='';
批量审核文档,代码如下:
- Update`detest_arctiny`setarcrank='0'wherearcrank='-1';
- Update`detest_archives`setarcrank='0'wherearcrank='-1';
批量删除未审核的文档,代码如下:
- DELETEFROMdetest_addonarticlewhereaidin(selectidfromdetest_arctinywherearcrank='-1');
- DELETEFROM`detest_arctiny`wherearcrank='-1';
- DELETEFROM`detest_archives`wherearcrank='-1';
- TRUNCATETABLE`detest_member_space`;
- TRUNCATETABLE`detest_member_tj`;