Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> removing duplicate records
Hi,
I'm not sure how I can achieve this in one SQL statement. I want to remove
duplicate id's from the following table.
SQL> select * from emp;
ID FIRST LAST
---------- ---------- ----------
1 MIKE SMITH 1 SUE GAINER 1 DEB SHELLY 2 JOHN BAKER 3 DAN DOE 3 MIKE DOE
6 rows selected.
The results after removing the duplicates:
ID FIRST LAST
---------- ---------- ----------
1 MIKE SMITH 2 JOHN BAKER 3 DAN DOE
For each duplicate id, it does not matter which id I retain. It can be MIKE SMITH or SUE GAINER or DEB SHELLY.
thanks.
Ivan
![]() |
![]() |