[SOLVED] MySQL "unique"-type command?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
voltrader
Forum Contributor
Posts: 223
Joined: Wed Jul 07, 2004 12:44 pm
Location: SF Bay Area

MySQL "unique"-type command?

Post by voltrader »

I have a table of states, cities contained there-in, and associated zips.

I'd like to populate a listbox with a list of cities contained within a particular state, however, I receive quite a few duplicate results, because of the many zips per city.

Is there a MySQL command that will ignore a city, if that city has already been retrieved?

I've got to pick up the O'Reilly reference mentioned earlier :!:
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

select distinct city from cities where state = 'NJ'
User avatar
voltrader
Forum Contributor
Posts: 223
Joined: Wed Jul 07, 2004 12:44 pm
Location: SF Bay Area

Post by voltrader »

Thanks folks
Post Reply