refactor xero__net_fees_by_deal
This commit is contained in:
parent
0ffcfca6a8
commit
423457126f
4 changed files with 44 additions and 9 deletions
|
|
@ -1,7 +1,11 @@
|
|||
with int_xero__credit_notes as (select * from {{ ref("int_xero__credit_notes") }}),
|
||||
with
|
||||
int_xero__credit_notes as (select * from {{ ref("int_xero__credit_notes") }}),
|
||||
stg_xero__accounts as (select * from {{ ref("stg_xero__accounts") }})
|
||||
select
|
||||
cn.id_credit_note,
|
||||
cn.credit_note_issued_at_utc,
|
||||
cn.credit_note_status,
|
||||
cn.id_contact,
|
||||
j.id_line_item,
|
||||
j.id_item,
|
||||
j.item_code,
|
||||
|
|
@ -73,4 +77,4 @@ cross join
|
|||
(jsonb_array_elements(cn.line_items) ->> 'AccountID') as id_account,
|
||||
(jsonb_array_elements(cn.line_items) ->> 'AccountCode') as account_code
|
||||
) j
|
||||
left join stg_xero__accounts a on j.account_code = a.account_code
|
||||
left join stg_xero__accounts a on j.account_code = a.account_code
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue