oracle union all错位汇总,oracle表的列合并(group by)和行合并(union all)

group by

selecta.dn,t.dn dnt,a.BEGIN_TIME,a.R032_001,t.R032_001,a.R032_002,a.R032_003,a.R032_004,

a.R032_005,t.R032_005,a.R032_006,a.R032_007,a.R032_008,a.R032_009,t.R032_009,a.R032_019,t.R032_019fromPM_LTE_CELL_3 a, PM_LTE_CELL_3CDLOBAK twhere a.dn =t.dnand a.begin_time =t.begin_timeand t.begin_time =to_date('2019-07-16 10:00:00', 'yyyy-mm-dd hh24:mi:ss')and t.dn = 'PLMN=1,AREA=4,TLSNB=275591,TdLtecell=1';

结果只有1行,但列数多了:

d5ca06dff47a52159b8ceca6d84e702b.png

union all

select a.dn,a.BEGIN_TIME,a.R032_001,a.R032_002,a.R032_003,a.R032_004,a.R032_005,a.R032_006,a.R032_007,a.R032_008,a.R032_009,a.R032_019

from PM_LTE_CELL_3 a

where a.dn = 'PLMN=1,AREA=4,TLSNB=275591,TdLtecell=1'

and a.begin_time =

to_date('2019-07-16 10:00:00', 'yyyy-mm-dd hh24:mi:ss')

UNION ALL

select a.dn,a.BEGIN_TIME,a.R032_001,a.R032_002,a.R032_003,a.R032_004,a.R032_005,a.R032_006,a.R032_007,a.R032_008,a.R032_009,a.R032_019

from PM_LTE_CELL_3CDLOBAK a

where a.dn = 'PLMN=1,AREA=4,TLSNB=275591,TdLtecell=1'

and a.begin_time =

to_date('2019-07-16 10:00:00', 'yyyy-mm-dd hh24:mi:ss')

结果有两行,列数没变:

4c6d7a8d64ad9ab5d12618ad83bfc74a.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值