Changed case to coalesce

This commit is contained in:
Joaquin Ossa 2024-07-03 17:38:00 +02:00
parent 3b22832d8b
commit 5bd6a2c254

View file

@ -35,26 +35,18 @@ select
case when gss.is_contactable is true then u.email else '' end as guest_email,
gss.experience_rating,
gss.guest_comments,
case when gss.is_contactable is true then true else false end as is_contactable,
coalesce(gss.is_contactable, false) as is_contactable,
gss.created_at_utc,
gss.updated_at_utc,
case
when v.verification_value is not null
then v.verification_value
else 'No Payment Validation Option'
end as selected_payment_option,
coalesce(
v.verification_value, 'No Payment Validation Option'
) as selected_payment_option,
u.date_of_birth,
extract(year from age(u.date_of_birth)) as age_of_guest,
case
when pt.has_check_in_cover_payment is true then true else false
end as has_check_in_cover_payment,
case
when pt.has_waiver_payment is true then true else false
end as has_waiver_payment,
case
when pt.has_deposit_payment is true then true else false
end as has_deposit_payment,
case when pt.has_fee_payment is true then true else false end as has_fee_payment
coalesce(pt.has_check_in_cover_payment, false) as has_check_in_cover_payment,
coalesce(pt.has_waiver_payment, false) as has_waiver_payment,
coalesce(pt.has_deposit_payment, false) as has_deposit_payment,
coalesce(pt.has_fee_payment, false) as has_fee_payment
from staging.stg_core__guest_satisfaction_responses gss
left join
staging.stg_core__verification_request vr