Select count / duplicates

Posted by mike on Stack Overflow See other posts from Stack Overflow or by mike
Published on 2010-03-25T14:55:50Z Indexed on 2010/03/25 15:03 UTC
Read the original article Hit count: 328

Filed under:
|
|

Hello!

I have a table with all U.S. zip codes. each row contains the city and state name for the zip code. I'm trying to get a list of cities that show up in multiple states. This wouldn't be a problem if there weren't X amount of zip codes in the same city...

So basically, I just want to the city in a state to count as 1 instead of it counting the city/state 7 times because there are 2+ zip codes in that city/state...

I'm not really sure how to do this. I know I need to use count but how do I tell the mysql to only count a given city/state combo as 1?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about sql