Praveesh P
Praveesh P

Reputation: 1449

How to find Duplicate element in a Table- Sybase

I have a table Tzipcode which has fields 'zipcode','cityName','country' etc. Some zipcodes are repeating, in the sense same Zipcode for more than one city.

I want to find out those zipcodes that exist more than once in the table. Also those zipcodes that exist more than twice.

Database: Sybase ASE

Upvotes: 1

Views: 5957

Answers (1)

pbasdf
pbasdf

Reputation: 21536

Try something like

Select zipcode, count(cityName) from Tzipcode group by zipcode having count(cityName) > 1

Upvotes: 1

Related Questions