Which of Fred's OrderNums do you want? If you don't care, then use

SELECT DISTINCT Name
FROM   table

If you want the Minimum, try

SELECT Name, MIN (OrderNum)
FROM   table
GROUP BY Name

> -----Original Message-----
> From: PC [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 03, 2000 10:45 PM
> To: [EMAIL PROTECTED]
> Subject: OT - SQL question
> 
> 
> Hey ...
> 
> How do you do a query where all rows returned except in the case of
> duplicates, based on a name column, in which only the first 
> is returned.
> 
> So the query run against the following rows:
> 
> Name    OrderNum
> Fred        21
> Beth        36
> Fred        76
> 
> Would return :
> Name    OrderNum
> Fred         21
> Beth         36
> 
> Much thanks!!
> 
> 
> --------------------------------------------------------------
> ----------------
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit 
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=list
s/cf_talk or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to