最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
通过DEDECMS后台的SQL指定条件删除文章
时间:2022-06-25 16:36:55 编辑:袖梨 来源:一聚教程网
第一点: 织梦DEDECMS的文章是分别存储在三个表里面[addonarticle],[archives],[arctiny]通过addonarticle.aid、archives.id、arctiny.id关联,删除文章时,应该删除三个表里的记录.
第二点: 执行SQL可以从PHPMYADMIN,或者DEDECMS后台系统设置-SQL命令行工具里
第三点: 本次手动删除内容为空或者字数少于200的文章,分了两步分别删除两个表,总结代码如下:
1: 查看要删除文章的代码:
代码如下 | 复制代码 |
select * from addonarticle where length(body)<200 |
2: 删除内容表.
代码如下 | 复制代码 |
delete from addonarticle where length(body)<200 delete from addonarticle where length(body)<200 |
3: 查看要删除文章的第二个表的代码:
代码如下 | 复制代码 |
left join addonarticle t2 on t1.id=t2.aid 04.where t2.aid is null and t1.channel=1 select * from archives t1 left join addonarticle t2 on t1.id=t2.aid where t2.aid is null and t1.channel=1 |
4: 删除第二个表.
代码如下 | 复制代码 |
left join addonarticle t2 on t1.id=t2.aid 04.where t2.aid is null and t1.channel=1 DELETE archives t1 from archives t1 left join addonarticle t2 on t1.id=t2.aid where t2.aid is null and t1.channel=1 |
5、查看要删除文章的第三个表的代码:
代码如下 | 复制代码 |
left join addonarticle t2 on t1.id=t2.aid 04.where t2.aid is null and t1.channel=1 select * from arctiny t1 left join addonarticle t2 on t1.id=t2.aid where t2.aid is null and t1.channel=1 |
6: 删除第三个表.
代码如下 | 复制代码 |
left join addonarticle t2 on t1.id=t2.aid 04.where t2.aid is null and t1.channel=1 |
如果你不查看的话,直接执行第2,4,6步就可以了,其中t1.channel=1是只操作普通文章类别的意思,防止删除软件等其他类别。
相关文章
- 魔法工艺拼图怎么通关 09-16
- 新三国志曹操传孙权有哪些技能 09-16
- 异星探险家超市如何搭建 09-16
- 逆战未来机甲武器怎么选择 09-16
- 三国望神州乐进有什么培养方法 09-16
- 阴阳师SP妙主九命猫怎么配队-妙主九命猫阵容搭配推荐 09-16