Page 1 of 1

Filling form select with non-duplicate data.

Posted: Fri Nov 01, 2002 9:09 pm
by Etherguy
Okay, if I got you this far by just the subject I must be going down the right path :)

Here is my problem, I have a mysql database with about 33,000 records or so. In field "a" there is a list of names full of duplicates ( which is fine ). What I would like to do is display the list of names in a drop down form, but want the names to only show up once not a million times.

Example : Lets say I have a name Robert Smith in field "a", the name Robet Smith is listed 20 times in that field because he put out 20 hits or what ever. Now I want to allow a user to select Robert Smith from a drop down form so that we can refine the search to just hits by just him.

I know how to produce the select form from the database, but can't seem to get it to display just once. Any help would be greatly appreciated.

Regards

Posted: Fri Nov 01, 2002 9:51 pm
by mydimension
SELECT DISTINCT(column_name) FROM table

that should do it. im a little shaky on the syntax but im pretty shure thats right.

Posted: Sat Nov 02, 2002 10:08 am
by DynamiteHost
mydimension, i find that doesnt work...

but i find this does:

SELECT DISTINCT column_name FROM table

Posted: Sat Nov 02, 2002 10:46 am
by mydimension
yeah, i thought the syntax was a little off. thx for the correction.

Posted: Sat Nov 02, 2002 12:12 pm
by DynamiteHost
np :)