Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> DISTINCT values
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