If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Geting unique values from field in table?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-23-05, 03:32
Ahhk Ahhk is offline
Registered User
 
Join Date: Sep 2005
Location: Austin, TX
Posts: 10
Geting unique values from field in table?

Hi all!

I have a table with a f_name field and I wan't to query a list of all the possible first names.

In other words, if the data were as such:

bob
john
david
john
bob
bob
mike
david

I'd want the output to be:

bob
john
david
mike

What's the query syntax for this?

TIA for any help!

Ahhk!
Reply With Quote
  #2 (permalink)  
Old 09-23-05, 03:41
felixg felixg is offline
Registered User
 
Join Date: Apr 2005
Location: Lier, Belgium
Posts: 122
Quote:
Originally Posted by Ahhk
I have a table with a f_name field and I wan't to query a list of all the possible first names.
SELECT DISTINCT f_name FROM foo;

--
felix
Reply With Quote
  #3 (permalink)  
Old 09-23-05, 09:52
Ahhk Ahhk is offline
Registered User
 
Join Date: Sep 2005
Location: Austin, TX
Posts: 10
distinct! Nice...didnt even see that looking through the references. Thanks felixg
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On