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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Sub-query in order by clause

RE: Sub-query in order by clause

From: Lyndon Tiu <ltiu_at_alumni.sfu.ca>
Date: Fri, 04 Apr 2003 14:09:03 -0800
Message-ID: <F001.0057AF70.20030404140903@fatcity.com>


Which way is faster? The subselect(nested select) or the join?

Thanks.

-- 
Lyndon Tiu


Quoting Jacques Kilchoer <Jacques.Kilchoer_at_quest.com>:


> 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:IAIN.D.NICOLL_at_saic.com]
> >
> > 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:ash03_at_att.net]
> >
> > 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?
>
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Lyndon Tiu INET: ltiu_at_alumni.sfu.ca Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Received on Fri Apr 04 2003 - 16:09:03 CST

Original text of this message

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