复杂统计

xiaoxiao2026-08-30  20

月份 达标天数 总拜访次数 1月 2月 。。。 。。。 12月 合计 注:一天拜访两个或以上客户为“达标” 传入三个参数:用户ID、起止日期 select DATE_FORMAT(date1,'%Y-%m') as month, sum(case when count1>1 then 1 else 0 end) as times, sum(count1) as totalfrom(select DATE_FORMAT(v_date,'%Y-%m-%d') as date1,count(*) as count1from p_visit where submit_person = 2 and DATE_FORMAT(v_date,'%Y-%m-%d')>='2009-04-01' and DATE_FORMAT(v_date,'%Y-%m-%d')<='2009-05-31' group by DATE_FORMAT(v_date,'%Y-%m-%d')) as days group by month
转载请注明原文地址: https://www.6miu.com/read-5052090.html

最新回复(0)