dedecms中常用的数据表操作SQL语句 – DeDecms


avatar
pcwnas 2023-04-21 206

原文来自:https://www.zixuephp.com

dedecms中常用的数据表操作SQL语句

本文章总结了几乎所有常用的dedecms数据表中记录的操作sql语句,包括有删除,审核,批量修改等等.

删除所有注册会员,代码如下:

  1. DELETEFROM`detest_member`WHERE`detest_member`.`mid`!=1;
  2. TRUNCATETABLE`detest_member_flink`;
  3. TRUNCATETABLE`detest_member_person`;

批量修改栏目为动态,代码如下:

UPDATE `detest_arctype` SET `isdefault` = '-1'

批量删除文章,代码如下:

  1. DELETEFROMdetest_addonarticleWHEREaid>0;
  2. DELETEFROMdetest_arctinyWHEREid>0;
  3. DELETEFROMdetest_archivesWHEREid>0;

批量修改文章为动态显示,代码如下:

update detest_archives set ismake=-1;

批量修改文章为静态显示,代码如下:

update detest_archives set ismake=1;

批量删除所有内容为空文章,代码如下:

  1. DELETEFROMdetest_arctinywhereidin(selectaidfromdetest_addonarticlewherebody='');
  2. DELETEFROMdetest_archiveswhereidin(selectaidfromdetest_addonarticlewherebody='');
  3. DELETEFROMdetest_addonarticlewherebody='';

批量删除标题为空的文章,代码如下:

  1. DELETEFROMdetest_addonarticlewhereaidin(selectidfromdetest_archiveswheretitle='');
  2. DELETEFROMdetest_arctinywhereidin(selectidfromdetest_archiveswheretitle='');
  3. DELETEFROMdetest_archiveswherewheretitle='';

批量审核文档,代码如下:

  1. Update`detest_arctiny`setarcrank='0'wherearcrank='-1';
  2. Update`detest_archives`setarcrank='0'wherearcrank='-1';

批量删除未审核的文档,代码如下:

  1. DELETEFROMdetest_addonarticlewhereaidin(selectidfromdetest_arctinywherearcrank='-1');
  2. DELETEFROM`detest_arctiny`wherearcrank='-1';
  3. DELETEFROM`detest_archives`wherearcrank='-1';
  4. TRUNCATETABLE`detest_member_space`;
  5. TRUNCATETABLE`detest_member_tj`;