PDA

View Full Version : return only distinct matches


dswimboy
01-30-2005, 10:40 PM
I have a table with three Keys. riverID (Primary), river name, and state. I want to list all the states that have rivers in them. the following query returns states multiple times, becuase there are multiple rivers in each state.
SELECT `state`
FROM `rivers`What do I do to return the states that have rivers in them ony once?

If you don't understand my question, please ask for an example. If you do understand my question and know I'm not describing properly, please help me describe it.

Sayonara
01-30-2005, 10:49 PM
SELECT DISTINCT 'field_name'

:)

dswimboy
01-31-2005, 02:04 AM
how wonderfully simple. this forum is excellent for stupid little questions like this

Sayonara
01-31-2005, 10:12 AM
Isn't it nice when a language uses a sensible word for a command?