Commit 02e3a55d by jianan

PEP本周分值

parent 55f2e02c
......@@ -107,8 +107,12 @@
p.mobile_no,
p.customer_id,
sum(case when to_days(t.track_time) = to_days(now()) then COALESCE(t.track_score,0) else 0 end) dayScore,
sum(case when YEARWEEK(date_format(t.track_time,'%Y-%m-%d'),1) = YEARWEEK(now(),1) then COALESCE(t.track_score,0) else 0 end) weekScore,
sum(case when date_format(t.track_time,'%Y-%m')=date_format(now(),'%Y-%m') then COALESCE(t.track_score,0) else 0 end) monthScore
sum(case when YEARWEEK(date_format(t.track_time,'%Y-%m-%d'),1) = YEARWEEK(now(),1)
and to_days(t.track_time) <= to_days(now())
then COALESCE(t.track_score,0) else 0 end) weekScore,
sum(case when date_format(t.track_time,'%Y-%m')=date_format(now(),'%Y-%m')
and to_days(t.track_time) <= to_days(now())
then COALESCE(t.track_score,0) else 0 end) monthScore
from ag_acl_practitioner p
left join (select practitioner_id, track_time, track_score
from ag_mkt_schedule_task_tracking where md_drop_option_id not in (223,224,225,226,227)
......
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