question on DISTINCT [message #9159] |
Thu, 23 October 2003 03:15 |
siva
Messages: 58 Registered: August 1999
|
Member |
|
|
how to select distinct rows from a table,for example if there is a table x(deptno,dname) and there are duplicate tuples in deptno , how to select distinct tuples of deptno and display the table with distinct values of deptno and dname.
Thank u.
|
|
|
Re: question on DISTINCT [message #9160 is a reply to message #9159] |
Thu, 23 October 2003 05:53 |
jseven
Messages: 28 Registered: October 2003
|
Junior Member |
|
|
create table test(no number,dname varchar2(20));
SQL> select * from test;
NO DNAME
---------- --------------------
1 oper
2 mktg
1 sales
select * from test where rowid in(select max(rowid) from test group by no);
hope this works out for you
|
|
|
|