Created int model for host accommodations with check in hero
This commit is contained in:
parent
5cc248de9c
commit
cbd1b4414f
1 changed files with 62 additions and 0 deletions
62
models/intermediate/core/int_core__check_in_cover_users
Normal file
62
models/intermediate/core/int_core__check_in_cover_users
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
with
|
||||
stg_core__accommodation_to_user as (
|
||||
select * from {{ ref("stg_core__accommodation_to_user")}}
|
||||
),
|
||||
stg_core__accommodation as (
|
||||
select * from {{ ref("stg_core__accommodation")}}
|
||||
),
|
||||
stg_core__user as (
|
||||
select * from {{ ref("stg_core__user")}}
|
||||
),
|
||||
stg_core__verification_set as (
|
||||
select
|
||||
id_user_host,
|
||||
id_verification_set
|
||||
from {{ ref("stg_core__verification_set")}}
|
||||
),
|
||||
stg_core__verification_set_to_verification_type as (
|
||||
select
|
||||
id_verification_set,
|
||||
id_verification_type
|
||||
from {{ ref("stg_core__verification_set_to_verification_type")}}
|
||||
)
|
||||
select
|
||||
atu.id_user_owner as id_user_host,
|
||||
atu.id_accommodation,
|
||||
atu.accommodation_user_type,
|
||||
atu.created_at_utc,
|
||||
atu.updated_at_utc,
|
||||
ac.friendly_name,
|
||||
ac.id_country,
|
||||
ac.is_active,
|
||||
ac.town,
|
||||
ac.address_line_1,
|
||||
us.email,
|
||||
us.joined_at_utc,
|
||||
us.joined_date_utc,
|
||||
us.last_name,
|
||||
us.user_name,
|
||||
us.first_name,
|
||||
us.company_name,
|
||||
us.phone_number
|
||||
from
|
||||
stg_core__accommodation_to_user atu
|
||||
left join
|
||||
stg_core__accommodation ac on atu.id_accommodation = ac.id_accommodation
|
||||
left join
|
||||
stg_core__user us on atu.id_user_owner = us.id_user
|
||||
inner join (
|
||||
select
|
||||
vs.id_user_host,
|
||||
vs.id_verification_set,
|
||||
vstvt.id_verification_set,
|
||||
vstvt.id_verification_type
|
||||
FROM
|
||||
stg_core__verification_set vs
|
||||
left join
|
||||
stg_core__verification_set_to_verification_type vstvt on vs.id_verification_set = vstvt.id_verification_set
|
||||
where
|
||||
vs.is_active is true and
|
||||
vstvt.id_verification_type = 15
|
||||
) as vsat on vsat.id_user_host = atu.id_user_owner
|
||||
order by atu.id_user_owner, atu.id_accommodation
|
||||
Loading…
Add table
Add a link
Reference in a new issue