How to delete duplicate Posts in DLE?

Status
Not open for further replies.

sSKKa

Active Member
1,124
2010
141
0
i am running DLE site.... is there any query in SQL for "title" id so that i could delete duplicate records... I found this in google but its not working......

Code:
http://www.webtlk.com/2009/11/05/how-to-delete-duplicate-records-in-your-sql-database/
I am using this command

PHP:
SELECT title, COUNT(*) FROM dle_post
Group BY Duplicate_dle_post  HAVING COUNT(*) > 1
First code works great and it shows me the result but when i execute the second query it says unknown column find.
 
Last edited:
4 comments
Sorry for the bump, here's the solution i just use :) (too many dle poster spammer post same title LOL)

Execute this to "shows" which title duplicate
Code:
SELECT a.ID, a.title
FROM dle_post AS a
   INNER JOIN (
      SELECT title, MIN( id ) AS min_id
      FROM dle_post
      GROUP BY title
      HAVING COUNT( * ) > 1
   ) AS b ON b.title = a.title
AND b.min_id <> a.id

Execute this to "delete" duplicate articles, and left the first duplicate title.
Code:
DELETE a.*
FROM dle_post AS a
   INNER JOIN (
      SELECT title, MIN( id ) AS min_id
      FROM dle_post
      GROUP BY title
      HAVING COUNT( * ) > 1
   ) AS b ON b.title = a.title
AND b.min_id <> a.id
 
Status
Not open for further replies.
Back
Top