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: dificult SQL

Re: dificult SQL

From: Valery Yourinsky <vsu_at_bill.mts.ru>
Date: Wed, 10 Jan 2001 09:32:46 +0300
Message-ID: <3A5C020E.4F0FDEEA@bill.mts.ru>

chemarey_at_my-deja.com wrote:
>
> Hi. I'd like to know how can i order the elements of a query with UNION.
>
> For example:
>
> select customer,inc from table1
> UNION
> select customer,inc from table2
>
> The idea is order by the inc item, but DBMS returns an error if a put
> the order by clause in the two different selects like
>
> select customer,inc from table1 order by inc asc
> UNION
> select customer,inc from table2 order by inc asc.
>
> Do you know if is possiblke to do this and how can i do.

     select customer,inc from table1 order by inc asc UNION
     select customer,inc from table2 order by inc asc. ORDER BY 2  See also

     "Oracle8i SQL Reference" 
          SELECT and subquery

Valery Yourinsky

-- 
Oracle8 Certified DBA
Received on Wed Jan 10 2001 - 00:32:46 CST

Original text of this message

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