tommym121
asked on
SQL - How to get unique records based on first and last name from a table
I would like to find out how I can get all the unique records from a table based on the first name and last name
e.g.
First|Last|Address
John|Smith|15 Church St
Holly|Land|1 Charles Cres
John|Smith|15 Church St
The result I hope to get is
First|Last|Address
John|Smith|15 Church St
Holly|Land|1 Charles Cres
e.g.
First|Last|Address
John|Smith|15 Church St
Holly|Land|1 Charles Cres
John|Smith|15 Church St
The result I hope to get is
First|Last|Address
John|Smith|15 Church St
Holly|Land|1 Charles Cres
SELECT First, Last, Address FROM Table GROUP BY First,Last,Address
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
select firstname+' '+lastname AS NAME from temptable
group by firstname,lastname
ASKER
Thanks
SELECT DISTINCT FirstName,LastName,.... FROM table
ORDER BY FrstName,LastName
and if you still get duplicates then you need to work out a GROUP BY FrstName,LastName instead.