【发布时间】:2020-05-21 06:54:28
【问题描述】:
我有下一个问题:
如果您看到图片,我想要添加或减去 VALUES,但老实说,我不知道如何开始?
这就是我得到这个结果的方式
select position, position_1, TIPO_RESUMEN, CONCEPT, to_char(NVL(VALUE,0) ,'FM999G999G999G999G990D00', 'NLS_NUMERIC_CHARACTERS='',.''') as VALUE
from (
SELECT 1 position, 10 position_1, 'Expense' TIPO_RESUMEN, 'Expected expense' CONCEPT ,sum(IMP_GA_GU) VALUE from table_1 tg where UPPER(tg.cod) = 'USER_1' and tg.cod_fol = :P10_FOL and tg.prod_cuad = :P10_PROD and tg.fecha_inicio = :P10_FEC_INI and tip_ga = 'PREVISTO'
union
SELECT 2 position, 20 position_2, 'Expense' TIPO_RESUMEN, 'Unforeseen expense' CONCEPT ,sum(IMP_GA_GU) VALUE from table_2 tp where UPPER(tp.cod) = 'USER_1' and tp.cod_fol = :P10_FOL and tp.prod_cuad = :P10_PROD and tp.fecha_inicio = :P10_FEC_INI and tp.tip_ga = 'NO_PREVISTO'
union
SELECT 3 position, 30 position_3, 'Expense' TIPO_RESUMEN, 'Total' CONCEPT , 0 VALUE from dual
);
我需要总价值是(预期费用 + 意外费用)的总和
谁能帮帮我?
问候
【问题讨论】: