49 lines
1.6 KiB
SQL
49 lines
1.6 KiB
SQL
with
|
|
stg_core__booking as (select * from {{ ref("stg_core__booking") }}),
|
|
stg_core__booking_state as (select * from {{ ref("stg_core__booking_state") }}),
|
|
int_core__duplicate_bookings as (
|
|
select id_booking, is_duplicate_booking, is_duplicating_booking_with_id
|
|
from {{ ref("int_core__duplicate_bookings") }}
|
|
),
|
|
int_core__price_plans as (select * from {{ ref("int_core__price_plans") }}),
|
|
int_core__verification_requests as (
|
|
select * from {{ ref("int_core__verification_requests") }}
|
|
),
|
|
int_core__booking_charge_events as (
|
|
select * from {{ ref("int_core__booking_charge_events") }}
|
|
)
|
|
select
|
|
b.id_booking,
|
|
b.id_user_guest,
|
|
b.id_user_host,
|
|
b.id_integration,
|
|
b.id_accommodation,
|
|
b.id_booking_source,
|
|
b.id_verification_request,
|
|
b.id_staging_host_booking,
|
|
db.is_duplicate_booking,
|
|
db.is_duplicating_booking_with_id,
|
|
bs.booking_state,
|
|
b.check_in_at_utc,
|
|
b.check_in_date_utc,
|
|
b.check_out_at_utc,
|
|
b.check_out_date_utc,
|
|
bce.booking_fee_local,
|
|
booking_fee_charge_at_utc,
|
|
booking_fee_charge_date_utc,
|
|
b.summary,
|
|
b.guest_email,
|
|
b.guest_last_name,
|
|
b.guest_first_name,
|
|
b.guest_telephone,
|
|
b.additional_guests,
|
|
b.unsubscribe_verification_reminder,
|
|
b.created_at_utc,
|
|
b.created_date_utc,
|
|
b.updated_at_utc,
|
|
b.updated_date_utc,
|
|
b.dwh_extracted_at_utc
|
|
from stg_core__booking b
|
|
left join stg_core__booking_state bs on b.id_booking_state = bs.id_booking_state
|
|
left join int_core__duplicate_bookings db on b.id_booking = db.id_booking
|
|
left join int_core__booking_charge_events bce on b.id_booking = bce.id_booking
|