现在查询出来是下图的结果,请教怎么,合并下面 第 1 列 和 第 3 列的时间数据
下面是源码
select a.time
dqhlTime,a.count dqhlCount,b.time dsblTime,b.count dsblCount
from
(select to_char(sqsj,'YYYY-MM-DD') time,count(1) count
from yw_sqxx
where slyy like '2%' and zfzt='1' group by to_char(sqsj,'YYYY-MM-DD'))
a full join
(select to_char(sqsj,'YYYY-MM-DD') time,count(1) count from yw_sqxx
where slyy like '4%' and zfzt='1' group by to_char(sqsj,'YYYY-MM-DD'))
b on a.time = b.time order by dqhltime desc
下面是源码
select a.time
dqhlTime,a.count dqhlCount,b.time dsblTime,b.count dsblCount
from
(select to_char(sqsj,'YYYY-MM-DD') time,count(1) count
from yw_sqxx
where slyy like '2%' and zfzt='1' group by to_char(sqsj,'YYYY-MM-DD'))
a full join
(select to_char(sqsj,'YYYY-MM-DD') time,count(1) count from yw_sqxx
where slyy like '4%' and zfzt='1' group by to_char(sqsj,'YYYY-MM-DD'))
b on a.time = b.time order by dqhltime desc
@卖水果的net
@卖水果的net
from yw_sqxx
where slyy like '2%' and zfzt='1' group by to_char(sqsj,'YYYY-MM-DD')
union all
select to_char(sqsj,'YYYY-MM-DD') dsbltime,count(1) dsblcount from yw_sqxx
where slyy like '4%' and zfzt='1' group by to_char(sqsj,'YYYY-MM-DD')
order by dqhltime descunion all 可以实现吗?
你是想排序时,按合并后的内容排序吗?order by nvl(col1,col3)