18 June 2018

FreshRSS: Delete duplicate entries by title

If you have duplicate entries in your FreshRSS database, here is method for delete duplicate entries by title via phpMyAdmin:

Next SQL statement SELECT ALL duplicate entries by title:

SELECT * FROM `freshrss_slpadmin_entry` AS a
 INNER JOIN (
   SELECT title
     FROM `freshrss_slpadmin_entry`
     GROUP BY title
   HAVING COUNT( * ) > 1
 ) AS b ON b.title = a.title
ORDER BY a.title

Next SQL statement SELECT duplicate entries by title with higher id:

SELECT * FROM `freshrss_slpadmin_entry` AS a
 INNER JOIN (
   SELECT title, MIN(id) AS min_id
     FROM `freshrss_slpadmin_entry`
     GROUP BY title
   HAVING COUNT( * ) > 1
 ) AS b ON b.title = a.title
AND b.min_id <> a.id
ORDER BY a.title

Next SQL statement DELETE duplicate entries by title with DIFFERENT id:

DELETE a.* FROM `freshrss_slpadmin_entry` AS a
 INNER JOIN (
   SELECT title, MIN(id) AS min_id
     FROM `freshrss_slpadmin_entry`
     GROUP BY title
   HAVING COUNT( * ) > 1
 ) AS b ON b.title = a.title
AND b.min_id <> a.id 

No comments: