Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: sql question - distinct
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 PortasReceived on Wed Nov 29 2006 - 15:04:54 CST