日期:2014-05-17 浏览次数:20998 次
with
t as (select 'D1' "编号", 'A' "名称",'X' "类别",100 "金额" from dual
union all
select 'D2' "编号", 'B' "名称",'Y' "类别",200 "金额" from dual
union all
select 'D3' "编号", 'C' "名称",'X' "类别",150 "金额" from dual
union all
select 'D3' "编号", 'C' "名称",'Y' "类别",300 "金额" from dual
union all
select 'D4' "编号", 'D' "名称",'X' "类别",500 "金额" from dual),
t1 as (select 'D1' "编号",'X' "类别",890 "结算金额",'电汇' "结算方式" from dual
union all
select 'D2' "编号",'Y' "类别",751 "结算金额",'承兑' "结算方式" from dual
union all
select 'D3' "编号",'X' "类别",521 "结算金额",'电汇' "结算方式" from dual
union all
select 'D4' "编号",'X' "类别",654 "结算金额",'电汇' "结算方式" from dual
)
select t."编号",t."名称",t."类别",t."金额",decode(t1."结算金额",null,0,t1."结算金额"),t1."结算方式"
from t left join t1 on
t."编号"=t1."编号"