1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
t1.count as toDay, tt1.count as lastDay, t2.count as lastWeek, tt2.count as toWeek, t3.count as lastMonth, tt3.count as toMonth, t4.count as toYear, tt4.count as lastYear, t.count as total from (SELECT count(id) as count FROM user WHERE date_format(createtime,'%Y-%m-%d')=date_format(now(),'%Y-%m-%d')) t1, (SELECT count(id) as count FROM user WHERE TO_DAYS(NOW())-TO_DAYS(createTime) = 1) tt1, (SELECT count(id) as count FROM user WHERE YEARWEEK(date_format(createTime,'%Y-%m-%d')) = YEARWEEK(now())-1) t2, (SELECT count(id) as count FROM user WHERE YEARWEEK(date_format(createTime,'%Y-%m-%d')) = YEARWEEK(now())) tt2, (select count(id) as count from user where date_format(createtime,'%Y-%m')=date_format(DATE_SUB(curdate(), INTERVAL 1 MONTH),'%Y-%m')) t3, (SELECT count(id) as count FROM user WHERE date_format(createtime,'%Y-%m')=date_format(now(),'%Y-%m')) tt3, (select count(id) as count from `user` where YEAR(createTime)=YEAR(NOW())) t4, (select count(id) as count from `user` where YEAR(createTime)=YEAR(NOW())-1) tt4, (select count(id) as count from user) t
|