do both rates to compare and test

This commit is contained in:
Pablo Martin 2024-06-18 11:13:51 +02:00
parent e3be2708ad
commit 6f625ec7db

View file

@ -35,6 +35,7 @@ select
p.amount as amount_in_txn_currency, p.amount as amount_in_txn_currency,
p.currency, p.currency,
(p.amount * r.rate) as amount_in_gbp, (p.amount * r.rate) as amount_in_gbp,
(p.amount * nr.rate) as new_amount_in_gbp,
ps.payment_status, ps.payment_status,
p.notes p.notes
from stg_core__verification_to_payment vtp from stg_core__verification_to_payment vtp
@ -49,3 +50,8 @@ left join
on p.paid_date_utc = r.rate_date on p.paid_date_utc = r.rate_date
and p.currency = r.from_currency and p.currency = r.from_currency
and r.to_currency = 'GBP' and r.to_currency = 'GBP'
left join
int_simple_exchange_rates nr
on p.paid_date_utc = nr.rate_date_utc
and p.currency = nr.from_currency
and nr.to_currency = 'GBP'