have a table that has a column called article_title. Let's say the
table name is articles. I need to find out the records where the
article_title data is the same on more than one record.
Sound like to me you also need to have the id because you want to find records based on article_title because you have duplicates
Basic MIN/MAX with GROUP BY (you will miss id's when more then 2 duplicates)
SELECT
MIN(id) -- for FIFO id's (first id by duplicate)
, MAX(id) -- for LIFO id's (last id by duplicate)
, article_title
, COUNT(*)
FROM
articles
WHERE -- Maybe to filter out '' or IS NOT NULL
article_title != '' AND article_title IS NOT NULL
GROUP BY
article_title ASC
HAVING
COUNT(*) >= 2
;
Or back to denormalisation to generate an CSV for LIFO id's (older id's by duplicates) but you know all id's here..
SELECT
GROUP_CONCAT(id ORDER BY ASC SEPARATOR ',') -- change to DESC if want the last record first
, article_title
, COUNT(*)
FROM
articles
GROUP BY
article_title ASC
HAVING
COUNT(*) >= 2
;