I’m trying to find records which have matching column values — the problem being, I don’t know what those values are.
In this instance, the values are the names of delegates (“John Smith”, “Anna Jones” et cetera), and I’m wanting to gather those records where a delegate has added more than one.
Does that make sense?
For the life of me, I just can’t think of how to express this as a query, so I’m hoping you guys can assist!
It doesn’t even select a whole record, just the names that occur more than once. Join the result to the original table (on name) and you’ll have your rows:
SELECT
....
FROM table AS t1
INNER JOIN
(SELECT
name AS dupname
FROM table
GROUP BY name
HAVING COUNT(*) > 1
) AS t2
ON t1.name = t2.dupname