From 1a347c721b98b6c24131b767a782201098e31502 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Fri, 8 Mar 2024 17:58:14 +0100 Subject: [PATCH] use it in downstream --- models/intermediate/int_core__guest_fee_txns.sql | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/models/intermediate/int_core__guest_fee_txns.sql b/models/intermediate/int_core__guest_fee_txns.sql index b4ffd1e..adac6ac 100644 --- a/models/intermediate/int_core__guest_fee_txns.sql +++ b/models/intermediate/int_core__guest_fee_txns.sql @@ -2,15 +2,18 @@ with stg_core__verification_to_payment as ( select * from {{ ref("stg_core__verification_to_payment") }} ), + stg_core__verification_payment_type as ( + select * from {{ ref("stg_core__verification_payment_type") }} + ), monster_payment_join as ( select vtp.*, vpt.*, p.*, ps."Name" from stg_core__verification_to_payment vtp left join - sync_core."VerificationPaymentType" vpt - on vtp.id_verification_to_payment = vpt."Id" + stg_core__verification_payment_type vpt + on vtp.id_verification_to_payment = vpt.id_verification_payment_type left join sync_core."Payment" p on vtp.id_payment = p."PaymentId" left join sync_core."PaymentStatus" ps on p."PaymentStatusId" = ps."Id" - where vpt."Name" = 'Fee' -- and vtp."VerificationId" = 800000 + where vpt.verification_payment_type = 'Fee' ) select payment_due_at_utc, "Amount" as amount from monster_payment_join