oracle9i里面,有个应用,想为一个select结果集赋2个别名,如何实现呢?
代码:
select
a.*
from (select
trunc(((substr(to_char(endtime,'yyyy-mm-dd hh24:MM:ss') ,12,2)-7) *60+
substr(to_char(endtime,'yyyy-mm-dd hh24:MM:ss') ,15,2))/10) as area,
sum(paymoney) as per_area_sum
from info_business_ent
where state='1' and
to_number(substr(to_char(endtime,'yyyy-mm-dd hh24:MM:ss') ,12,2)) between 7 and 23
group by trunc(((substr(to_char(endtime,'yyyy-mm-dd hh24:MM:ss') ,12,2)-7) *60+
substr(to_char(endtime,'yyyy-mm-dd hh24:MM:ss') ,15,2))/10)
)a ;
上面的语句中只取了一个别名a,还想实现这样:
select
a.*,
b.*
from (select
trunc(((substr(to_char(endtime,'yyyy-mm-dd hh24:MM:ss') ,12,2)-7) *60+
substr(to_char(endtime,'yyyy-mm-dd hh24:MM:ss') ,15,2))/10) as area,
sum(paymoney) as per_area_sum
from info_business_ent
where state='1' and
to_number(substr(to_char(endtime,'yyyy-mm-dd hh24:MM:ss') ,12,2)) between 7 and 23
group by trunc(((substr(to_char(endtime,'yyyy-mm-dd hh24:MM:ss') ,12,2)-7) *60+
substr(to_char(endtime,'yyyy-mm-dd hh24:MM:ss') ,15,2))/10)
)a b;
该如何操作?