Wednesday, June 04, 2008

selecting duplicate rows in atable

I have a table of city names and need to find duplicate entries. The table does not have a primary key, so the duplicate rows are entirely identical.

Answer:

select city_name, count(city_name) as cnt from areas group by city_name where cnt>1