Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> DISTINCT values

DISTINCT values

From: <sweidanz_at_yahoo.com>
Date: Fri, 16 Nov 2001 10:46:05 +1100
Message-ID: <gHWK7.22$Mi4.739@nsw.nnrp.telstra.net>

Folks,
I am a bit confused with whats the difference between: SELECT DISTINCT column1, column2
and
SELECT DISTINCT (column1) , column2

As far as i used to understand, is the first one will give you the distinct rows. and the second one will give the distinct column1 even if there are non unique values in column2.

For example,
column1= acct_no
column2= transaction_date
and the data as follows:
acct_no transaction_date

1       01/12/2000
1       02/12/2000
1       02/12/2000
2       03/02/2001
2       04/02/2001

so if i run the first query i should get:  

1       01/12/2000
1       02/12/2000
2       03/02/2001
2       04/02/2001

and as i used to understand, if i run the second query:
1       01/12/2000
2       03/02/2001

BUT, its not returning what i expected. the second query returned exactly the same as first query.

thanks,
ZS Received on Thu Nov 15 2001 - 17:46:05 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US