Helpful Information
 
 
Category: Oracle Development
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

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"

SELECT DISTINCT id, field1, field2, field3, field4
FROM table
GROUP BY id
ORDER BY last_name










privacy (GDPR)