Commit 09394238 by yao.xiao

补充提交

parent 9e930b39
......@@ -733,9 +733,10 @@
(SELECT md.drop_option_name from ag_md_drop_options md LEFT JOIN ag_mkt_leads_assigned_track amlat ON md.id = amlat.md_drop_option_id where amlat.practitioner_id = a.assigned_practitioner_id and amlat.customer_id = a.customer_id ORDER BY amlat.created_at DESC LIMIT 1) mdDropOptionName,
(SELECT sum(t.track_score) from ag_mkt_leads_assigned_track t where t.leads_assigned_id = a.id) scoreTotal ,
(SELECT sum(t.track_score) from ag_mkt_leads_assigned_track t where t.leads_assigned_id = a.id and to_days(track_time) = to_days(now())) scoreDay,
if((select count(*) from ag_mkt_leads_expert_assign ass left join ag_mkt_leads_expert_request r on r.id = ass.leads_expert_request_id where r.customer_id = a.customer_id and a.assigned_practitioner_id = ass.expert_practitioner_id ) = 0,0,1) expertType
if(ass.id is null ,0,1) expertType
FROM
ag_mkt_leads_assigneds a
left join ag_mkt_leads_expert_request r left join ag_mkt_leads_expert_assign ass on ass.leads_expert_request_id = r.id on r.customer_id = a.customer_id
LEFT JOIN ag_mkt_leads_pool p ON p.customer_id = a.customer_id
LEFT JOIN ag_acl_customer c ON c.id = a.customer_id
where a.is_active=1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment