mysql 按每天统计

参考代码

SELECT reg_time, 
       total1 , 
       @total := @total + total1 AS Counter 
FROM  ( select date(CreatedDate) as reg_time,count(*) as total1,
        (select count(*) from ycf_dwh_fdm.f_cus_customer where PhoneCityId = 199 ) as sum 
        from ycf_dwh_fdm.f_cus_customer  where PhoneCityId = 199 group by date(reg_time)
      ) 
AS temp, (SELECT @total := 0) AS T1  
ORDER BY reg_time;

 

转载于:https://my.oschina.net/heicai/blog/698471

你可能感兴趣的:(mysql 按每天统计)