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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Problem sorting results of a Union query passed to Oracle

Re: Problem sorting results of a Union query passed to Oracle

From: Mark Gumbs <mgumbs_at_nospam.hotmail.com>
Date: Mon, 21 Jun 1999 16:31:48 +0100
Message-ID: <376e5891.0@145.227.194.253>


<snip>

>use positional order by's with unions. for example, if login_timestamp is
the
>1'st column in the "*" (btw: it can be deadly to do a select "*" in a
program --
>you really should select c1, c2, c3, ... and so on) then you would "order
by 1"

>Thomas Kyte tkyte_at_us.oracle.com

  1 (select * from emp where empno=7934   2 union
  3 select * from emp where empno=7902)   4* order by 1
SQL> /     EMPNO ENAME JOB MGR HIREDATE SAL COMM

--------- ---------- --------- --------- --------- --------- ---------
     7902 FORD       ANALYST        7566 03-DEC-81      3000
     7934 MILLER     CLERK          7782 23-JAN-82      1300

True :-)

M Received on Mon Jun 21 1999 - 10:31:48 CDT

Original text of this message

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