Delete an article through DEDECMS background SQL specified criteria

Source: Internet
Author: User

1th: Dream dedecms articles are stored in three tables respectively [Addonarticle],[archives],[arctiny] through Addonarticle.aid, Archives.id, Arctiny.id Association, When you delete an article, you should delete the three-table record.
2nd: Execute SQL can be from phpMyAdmin, or DEDECMS background system Setup-sql command line tool
3rd: The manual deletion of the content is empty or less than 200 of the article, divided into two steps to delete two separate tables, the summary code is as follows:
1: View the code to delete the article:

The code is as follows Copy Code

SELECT * from addonarticle where length (body) <200

2: Delete the content table.

The code is as follows Copy Code

Delete from addonarticle where length (body) <200 Delete from addonarticle where length (body) <200

3: View the code for the second table where you want to delete the article:

The code is as follows Copy Code
Left join Addonarticle T2 in 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: Delete the second table.

The code is as follows Copy Code
Left join Addonarticle T2 to T1.id=t2.aid 04.where t2.aid is null and t1.channel=1 DELETE archives
From Archives t1
Left join Addonarticle T2 on T1.id=t2.aid
Where T2.aid is null and t1.channel=1

5, view the code to delete the third table of articles:

The code is as follows Copy Code
Left join Addonarticle T2 in 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: Delete the third table.

The code is as follows Copy Code

Left join Addonarticle T2 in T1.id=t2.aid 04.where t2.aid is null and t1.channel=1


If you do not see, you can directly perform the 2,4,6 step, where t1.channel=1 is only to manipulate the meaning of ordinary article categories, to prevent deletion of other categories such as software.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.