Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: UNION ALL and ordering
> select 1, col1, col2, ... from table1 order by col2
> UNION ALL
> select 2, col1, col2, ... from table2 order by col3
> ORDER BY 1
>
?
select 1 u, col1, col2, ... from table1 order by col2
UNION ALL
select 2 u, col1, col2, ... from table2 order by col3
ORDER BY 1, DECODE (u, 1, col2, col3)
Received on Sat Nov 24 2007 - 02:50:13 CST
![]() |
![]() |