How to find duplicate entry?

I have a table where cityName is a column.

I want to find if there are same cityName exists and if so how many count for each entry.

What is the query ?

that will give you all duplicates and number of them

select count(cityName) as num, cityName
from yourTable
having count(cityName)>1
group by cityName

very close…

… but HAVING comes after GROUP BY

:slight_smile: