Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get one record per duplicate field 1

Status
Not open for further replies.

sammye

Programmer
Oct 5, 2007
35
US
I’m having trouble retrieving just the 1st record where there are two available. Here’s an example table:

My table:
Name Address
---- -------
Bob 1st street
Bob 4th ave
Ann 3rd street
Ann 7th ave

What I’d like to retrieve:
Name Address
---- -------
Bob 1st street
Ann 3rd street

I don’t really care which record for Bob and Ann I retrieve, but I just want one for each. Any guesses? Thanks.
 
Code:
select name, min (address) As Address
from table
group by name

John
 
john, thanks for the help. exactly what I was looking for.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top