最新下载
热门教程
- 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是只操作普通文章类别的意思,防止删除软件等其他类别。
相关文章
- 抖音短视频网页版:官方入口一键直达 12-19
- 漫画岛入口在哪 最新漫画岛入口一览 12-19
- 女神漫画独家入口-女神漫画韩漫全集在线免费畅读入口 12-19
- 哔哩哔哩国产大片视频入口在哪-最新哔哩哔哩国产大片视频地址链接分享 12-19
- 抖音电脑版网页版入口-抖音官网PC端在线观看 12-19
- 126邮箱登录官网极速稳定-免费秒开收件箱畅快收发 12-19