leading-project/dw/dws/dws_finance_fees_serial_m.sql

25 lines
730 B
MySQL
Raw Normal View History

2024-07-21 22:06:45 +08:00
select
b.organ_code
, b.organ_name
, b.comm_id
, b.comm_name
, a.ym
, a.ParentCostCode
, a.ParentCostName
, a.pr_total_receivable_amt
, a.pr_total_received_amt
, a.cu_receivable_amt
, a.cu_exempt_cu_amt
, a.pr_exempt_cu_amt
, a.pr_paid_cu_amt
, a.cu_paid_cu_amt
, a.pr_offset_cu_amt
, a.cu_offset_cu_amt
, a.cu_paid_pr_amt
, a.cu_offset_pr_amt
, a.cu_early_exempt_pr_amt
, a.cu_exempt_pr_amt
from dwd_finance_fees_serial_d a
inner join (select distinct organ_code, organ_name, comm_id, comm_name from dim_organ_mapping) b
on a.commid = b.comm_id
order by b.organ_code, b.comm_id, a.ym, a.ParentCostCode