Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help : Order by with Union clause
On 19 Aug 1997 23:21:32 GMT, "Suman Mehta" <sumanp_at_yardi.com> wrote:
>Can we write an Order by Clause at the end of a select statement
>having the Union clause in it ?
>
>My SQL query (which has a union clause) works fine without
>it but gives an error message when I try to order by
>one of the columns.
>
>How do we overcome this problem ?
>
>
>----------------------------------------------
>Suman Mehta
>E-mail ID : sumanp_at_yardi.com
select a, b, c from T1
union all
select d, e, f from T2
order by 3, 2, 1
will order by c, b, a (f, e, d)
Use the numeric position of the column in the order by.
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD
http://govt.us.oracle.com/ -- downloadable utilities
![]() |
![]() |