Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> do the same without using union all
9.2.0.7 on solaris 9
CREATE TABLE mytab
(
curr_month varchar2(2), curr_day varchar2(2), curr_year varchar2(4),
If I run the SQL:
select
to_date(curr_year || '-' || curr_month || '-' || curr_day,
'YYYY-MM-DD')
,num1 as num
from mytab
union all
select
to_date(curr_year || '-' || curr_month || '-' || curr_day,
'YYYY-MM-DD')
,num2 as num
from mytab
order by 1
;
I get the result set I am looking for. I am running the pretty much the same SQL twice. This is not a big deal in a small table. I seem to recall I can do the same thing using one of the analytic functions. Does anyone know how to get this result set without using a union or a union all?
Thank you for your time.
Ox
Received on Thu May 04 2006 - 06:40:01 CDT