我想从单个表创建一个报表,并使用表的每个不同列作为单独的列,因此我可以将三行的数量减少到一个! the original table
这些带下划线的列作为相关item_value_afs的列标题! 结果应该是这样的! the wanted result image
我的第二个查询不正确请帮我解决这个问题! 第一个查询显示所有
select reg_no
item_no,
reg_date,
tax_decription,
ITEM_VALUE_AFS
from
sigtasad.mv_customs_report;
第二个查询/有用查询:
select distinct reg_no,
item_no,
reg_date,
(
select sum(code_tax_amount)
from sigtasad.d_customs_load ss
where ss.reg_no=e.reg_no
) import_duty,
(
select sum(code_tax_amount)
from sigtasad.d_customs_load ss
where ss.reg_no=e.reg_no
) as "Profit Tax For Import",
(
select sum(code_tax_amount)
from sigtasad.d_customs_load ss
where ss.reg_no=e.reg_no
) as "Import Tax With license 2%"
from sigtasad.d_customs_load e
where rownum<100;