September 8th, 2003, 04:02 PM
Select distinct but how to display all info
You will have to forgive me I am new to this, but I want to be able to do a select distinct based on ID number, but display all information from the table just not the duplicate entries. This is what I have but obiviously doesn't work.
select * from emp
where id = (select distinct id from emp)
order by last_name
Cann someone help the new guy out?
THanks in advance
September 9th, 2003, 03:44 AM
Posting the table structure could help ...
One thing: if "select distinct id from emp" returns more than one value you should use
"select * from emp
where id IN (select distinct id from emp)
order by last_name"
November 24th, 2003, 09:10 PM
SELECT DISTINCT id, field1, field2, field3, field4
GROUP BY id
ORDER BY last_name