mirror of
https://gitlab.com/cief-data/dbt_cloud.git
synced 2026-08-19 04:14:00 +00:00
48 lines
1.5 KiB
SQL
48 lines
1.5 KiB
SQL
--IMPORT
|
|
WITH users_and_companies AS (
|
|
SELECT * FROM {{ ref('int_crisp__users_and_companies_and_company_marking') }}
|
|
),
|
|
|
|
--LOGIC
|
|
split_user_data AS (
|
|
SELECT
|
|
id,
|
|
name,
|
|
phone,
|
|
email,
|
|
website,
|
|
score,
|
|
segment_list,
|
|
role,
|
|
seniority,
|
|
title,
|
|
gender,
|
|
timezone,
|
|
geo_country,
|
|
geo_city,
|
|
geo_region_code,
|
|
address,
|
|
locale_list,
|
|
geo_latitude,
|
|
geo_longitude,
|
|
last_activated_datetime,
|
|
people_created_datetime,
|
|
people_updated_datetime,
|
|
exchange_marking_id AS company_exchange_marking_id,
|
|
izyim_marking_id AS company_izyim_marking_id,
|
|
lite_marking_id AS company_lite_marking_id
|
|
|
|
FROM users_and_companies
|
|
),
|
|
|
|
--FINAL
|
|
final_dim_crisp__users AS (
|
|
SELECT
|
|
*
|
|
FROM split_user_data
|
|
)
|
|
SELECT * FROM final_dim_crisp__users
|
|
-- SELECT company_lite_marking_id, count(distinct(company_exchange_marking_id)) AS t1, count(distinct(company_izyim_marking_id)) AS t2
|
|
-- FROM final_dim_crisp__users GROUP BY company_lite_marking_id HAVING t1 >1 or t2 > 1
|
|
-- SELECT company_IZYIM_MARKING_ID, company_exchange_marking_id FROM final_dim_crisp__users
|
|
-- WHERE company_IZYIM_MARKING_ID IN ('1324FEN','3791YBE', '1291NSC', '2698LXA', '2431HEB', '2634PLT', '8299LIE', '1882KAI', '1889LBH', '913DLT', '1650GTB', '5903CSB', '6631GEB', '1656HBP', '1905JYW', '8265LSB', '7260UUT', '5989HSY') ORDER BY company_IZYIM_MARKING_ID |