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 -> Re: sql question - distinct

Re: sql question - distinct

From: David Portas <REMOVE_BEFORE_REPLYING_dportas_at_acm.org>
Date: 29 Nov 2006 13:04:54 -0800
Message-ID: <1164834294.068863.47380@l39g2000cwd.googlegroups.com>


PRP wrote:
> I have one doubt regarding distinct.
>
> select distinct(empno) ,ENAME from emp;
> select distinct EMPNO ,ENAME from emp;
> >From my understanding of distinct clause, both the above queries will
> give same result in all conditions. Is there any reason why I am
> allowed to write " distinct(columnname) " when its always expected
> to behave for the result row?

The same reason you are permitted to use parentheses around any scalar expression:

SELECT DISTINCT (a), (b), (a+b), (a+b+c) FROM tbl;

-- 
David Portas
Received on Wed Nov 29 2006 - 15:04:54 CST

Original text of this message

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