Code:
select
cal.fiscal_week,
h.role_type,
h.se,
sub.*
from (
select
ds_denali__call_disposition__c as disposition,
datepart(hour, dateadd(hour, -5, ds_denali__call_started__c)) as call_time,
datepart(dw, ds_denali__call_started__c) as day_of_week,
ds_denali__owner__c as owner
from homer.sfdc.ds_denali__dialsource_action__c
where ds_denali__call_disposition__c in ('No Contact', 'Voicemail', 'Internal', 'Progression - Decs Mkr', 'Progression - Other', 'No Prog - Decs Mkr', 'Decision Positive', 'Decision Negative', 'No Prog - Other')
and trunc(ds_denali__call_started__c) >= 2018-11-01) sub
left join homer.homer_mapping.insidesales_hierarchy h on ds.ds_denali__owner__c = h.sfdc_id
left join homer.homer_mapping.adp_fiscal_calendar cal on trunc(ds.ds_denali__call_started__c) = cal.day_date
I need to join everything, but the 'homer.sfdc.ds_denali__dialsource_action_c' is a monster table, so I'm trying to cut down as much time as I can by sub-querying. But I still need to join it to two other tables we have (listed in the left join). The error I'm running into is that it keeps telling me that 'ds.' doesn't exist. I'm just unsure if this is a foundational piece that I'm not familiar with since I'm self-taught and pretty new. Any and all help is appreciated.