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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete duplicate from a table

Status
Not open for further replies.

Ielamrani

MIS
Jul 7, 2005
183
US
Hi,
I have a table with data like this:

LastNm FirstNm
Smith John
Jordan Al
Jordan Al
Sheriff Ahmed
Sheriff Ahmed

I would like to eliminate duplicates from a table and keep only one record for each person.

The query would give me the following:

LastNm FirstNm
Smith John
Jordan Al
Sheriff Ahmed

Thanks

Ismail
 
SELECT DISTINCT LastNm, FirstNm
FROM yourTable

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thank you very much...
Sorry I did mention this in my previous question...
I am trying to add other colums (Like ProspectKey, Street, Apt, Zip etc..)but the duplicate are still there..

I put the following:
SELECT DISTINCT LastNm, FirstNm, ProspectKey, Street, Apt, Zip, Phone
FROM tblInfo

Thanks
 
Perhaps something like this (getting mixed infos from dups ...):
SELECT LastNm, FirstNm, Max(ProspectKey), Max(Street), Max(Apt), Max(Zip), Max(Phone)
FROM tblInfo
GROUP BY LastNm, FirstNm

Have a look here:

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top