【发布时间】:2020-10-10 22:53:20
【问题描述】:
对于以下 3706 错误消息,新手将不胜感激: 期望在单词“Calls”和“case”关键字之间有一些东西
SELECT distinct
b.emp_nbr,
b.prim_terr_desc,
a.sales_terr_nbr,
TRIM (B.first_nm) ||' '|| TRIM (B.last_nm) as AE_Name,
count (distinct call_nbr) as Calls
case (when a.sale_call_chanl_desc LIKE 'Face to Face%' then 'F2F'
when a.sale_call_chanl_desc = 'Telephone' then 'Phone'
when a.sale_call_chanl_desc LIKE 'Web Meeting%' then 'Web_Meeting'
end) as Channel
FROM isell_prod_view_db.sfdc_call_action a
LEFT OUTER JOIN isell_prod_view_db.sfdc_customer_info c ON (a.cust_acct_nbr = c.cust_acct_nbr and a.rec_delt_flg = 'N')
LEFT OUTER JOIN isell_prod_view_db.sfdc_opportunity d ON (d.cust_acct_nbr = c.cust_acct_nbr and d.delt_flg = 'N')
LEFT OUTER JOIN isell_prod_view_db.sfdc_user_profile b ON a.crte_by_user_key_nbr = b.user_key_nbr
LEFT OUTER JOIN isell_prod_view_db.sfdc_opportunity_item e ON (e.oprty_key_nbr = d.oprty_key_nbr and e.delt_flg = 'N')
where a.sale_call_stat_desc = 'Completed'
and a.sales_div_nbr = '8'
and a.sales_grp_nbr = '9'
and a.sales_org_nbr ='30'
and b.prim_terr_desc LIKE ('8-9-30%')
and a.priv_entr_flg='N'
and a.sale_call_chanl_desc is not null
and CAST(a.call_dt AS date format 'MM/DD/YYYY') between '06/01/2019' and '05/31/2020'
group by 1,2,3,4
【问题讨论】:
-
Calls后面需要逗号吗?