I have thousands of records (included duplicate posts) so now I want to delete old records (just leave the latest record) based on date.
My code is given below
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
The problem is that it random records base on ID. I really appreciate your help!
 
     
    