Reputation: 644
I am trying to pull distinct City
names and only one zipcode for any given City.
zip city state
00603 AGUADILLA PR
00604 AGUADILLA PR
00605 AGUADILLA PR
Query:
SELECT DISTINCT (city),(zip)
FROM zips
WHERE state = 'PR'
I tried group by clause as well, let me know where am I wrong here.
Upvotes: 0
Views: 54
Reputation: 116100
SELECT city, max(zip) from zips where state='PR' group by city, state
Upvotes: 1