I have table in mysql db from which I need to select thoose rows, which are duplicated more than given number of times, but result should not be merged (if that row was five times in table, I want it to appear five times in result)
Table has three columns: Id, Name, Surname
I have tried grouping like this:
SELECT t.Name, t.Surname FROM table t WHERE t.Id IN ( SELECT tt.Id FROM table tt GROUP BY tt.Name, tt.Surname HAVING count(*) > 10 ) I know where is my mistake - in this subquery, because as I understand it returns only one id per unique Name + Surname, but I don't know how to achieve desired behavior properly.