Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Query
SQL> create table test(col1 number,col2 varchar2(30));
Table created.
SQL> insert into test values(1,'Oracle');
1 row created.
SQL> / 1 row created.
SQL> insert into test values(2,'Oracle');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from test
2 ;
COL1 COL2
---------- ------------------------------ 1 Oracle 1 Oracle 2 Oracle
SQL> select col1,col2
2 from
3 (select col1,col2 from test group by col1,col2);
COL1 COL2
---------- ------------------------------ 1 Oracle 2 Oracle
SQL> select distinct col1||' '||col2 from test;
COL1||''||COL2
SQL>
-- Niall Litchfield Oracle DBA Audit Commission UK ***************************************** Please include version and platform and SQL where applicable It makes life easier and increases the likelihood of a good answer ****************************************** "Gopal" <oracleinform_at_yahoo.com> wrote in message news:1ed02c3a.0203110314.64225045_at_posting.google.com...Received on Mon Mar 11 2002 - 05:46:17 CST
> Hi,
>
> How to use distinct on 2 columns . For eg I have a table A with 2
> columns
>
> A B
>
> 1 Oracle
> 1 Oracle
> 2 ORACLE
>
> In the above example first 2 records 2 columns are equal hence I want
> only 1 record out of the 2 records , How to imply distinct on such
> records , not using the rowid .
>
> Rgds