我有2个查询,显示了2个不同的数据。
例如:一个查询具有IN
条件,显示UG_LENGTH
,另一个查询具有NOT IN
条件,显示AR_LENGTH
。我希望在单个查询中同时显示UG_LENGTH
和AR_LENGTH
。
下图是两者的查询
在查询
select RJ_FSA_ID, ROUND(SUM(NVL(CALCULATED_LENGTH,0)/1000), 4) AS UG_LENGTH
from NE.MV_SPAN@facid147
where SPAN_REF_NAME IN ('3x40-F-RG-ST-1L','2x40-F-G-ST-1L','1x40-F-G-ST-1L','2x40-F-RG-ST-1L','7x14MM-MICRO','1x14MM-MICRO',
'3x40-F-G-ST-1L','2x14MM-MICRO','1x40-F-1L-RED','4x40-F-RG-ST-1L')
and RJ_FSA_ID='MUMB1622'
group by RJ_FSA_ID;
字符串
不在查询中
select RJ_FSA_ID, ROUND(SUM(NVL(CALCULATED_LENGTH,0)/1000), 4) AS AR_LENGTH
from NE.MV_SPAN@facid147
where SPAN_REF_NAME NOT IN ('3x40-F-RG-ST-1L','2x40-F-G-ST-1L','1x40-F-G-ST-1L','2x40-F-RG-ST-1L','7x14MM-MICRO','1x14MM-MICRO',
'3x40-F-G-ST-1L','2x14MM-MICRO','1x40-F-1L-RED','4x40-F-RG-ST-1L')
and RJ_FSA_ID='MUMB1622'
group by RJ_FSA_ID;
型
如何合并这两个查询?
1条答案
按热度按时间hvvq6cgz1#
使用条件聚合:
字符串