[ Get number os each duplicated items on table ]
I'm getting duplicate items of my table doing this:
SELECT * FROM table GROUP BY name HAVING COUNT(*) >1
It returns each duplicate item. But I would like to show:
"repeat X times".
How can I "echo" the "count" in this case?
Answer 1
You should show the count()
, instead of *
:
select name, count(*)
from table
group by name
having count(*) > 1;