change in new deals
This commit is contained in:
parent
1ced79ca0a
commit
d6426b0066
3 changed files with 46 additions and 14 deletions
|
|
@ -38,24 +38,32 @@ with
|
|||
select
|
||||
coalesce(hd.id_deal, cd.id_deal) as id_deal,
|
||||
coalesce(hd.main_deal_name, cd.main_deal_name) as main_deal_name,
|
||||
case
|
||||
when hd.id_deal is not null then true else false
|
||||
end as is_deal_in_hubspot,
|
||||
coalesce(cd.has_active_pms, false) as has_active_pms,
|
||||
cd.active_pms_list,
|
||||
cd.main_billing_country_iso_3_per_deal,
|
||||
case
|
||||
when upper(hd.deal_pipeline) in ('API SALES') then 'API' else 'PLATFORM'
|
||||
end as client_type,
|
||||
hd.deal_start_date as effective_deal_start_date_utc,
|
||||
hd.deal_start_month as effective_deal_start_month,
|
||||
min(
|
||||
coalesce(hd.deal_start_date, cd.deal_start_date)
|
||||
) as effective_deal_start_date_utc,
|
||||
min(
|
||||
coalesce(hd.deal_start_month, cd.deal_start_month)
|
||||
) as effective_deal_start_month,
|
||||
min(hd.deal_cancellation_date) as hubspot_deal_cancellation_date_utc,
|
||||
min(hd.deal_cancellation_month) as hubspot_deal_cancellation_month,
|
||||
min(hd.hubspot_listing_segmentation) as hubspot_listing_segmentation
|
||||
from hubspot_deals hd
|
||||
full outer join core_deals cd on hd.id_deal = cd.id_deal
|
||||
group by 1, 2, 3, 4, 5, 6, 7, 8
|
||||
group by 1, 2, 3, 4, 5, 6, 7
|
||||
)
|
||||
select
|
||||
cd.id_deal,
|
||||
cd.main_deal_name,
|
||||
cd.is_deal_in_hubspot,
|
||||
cd.has_active_pms,
|
||||
cd.active_pms_list,
|
||||
cd.client_type,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue