参考代码
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;