Title: RE: Sub-query in order by clause

Why would you do that instead of
SELECT emp.deptno, empno, ename
FROM emp a, dept b
WHERE dept.deptno = emp.deptno
order by dept.deptname ;

> -----Original Message-----
> From: Nicoll, Iain [mailto:[EMAIL PROTECTED]]
>
> Don't really know but couldn't it be useful if you had

> ORDER BY ( SELECT deptname FROM dept
>             WHERE dept.deptno = emp.deptno)


> -----Original Message-----
> From: Ashish [mailto:[EMAIL PROTECTED]]
>
> In Oracle 9.2.0.1, you can now order by using a single-row subquery
> Here is an example:

> SELECT emp.deptno, empno, ename
> FROM emp
> ORDER BY ( SELECT deptno FROM dept
>             WHERE dept.deptno = emp.deptno );

> The question I have is what is the usefulness of this? Under which
> circumstances
> this can be used?

Reply via email to