SELECT date_format(from_unixtime(created_at),'%Y%m%d')as 'time' ,count(1) as 'num',
(select count(1) from tre_upgrade_log where new_grade=1 and date_format(from_unixtime(created_at),'%Y%m%d')=date_format(from_unixtime(t.created_at),'%Y%m%d'))as 'grade_01',
(select count(1) from tre_upgrade_log where new_grade=2 and date_format(from_unixtime(created_at),'%Y%m%d')=date_format(from_unixtime(t.created_at),'%Y%m%d'))as 'grade_02',
(select count(1) from tre_upgrade_log where new_grade=3 and date_format(from_unixtime(created_at),'%Y%m%d')=date_format(from_unixtime(t.created_at),'%Y%m%d'))as 'grade_03',
(select count(1) from tre_upgrade_log where new_grade=4 and date_format(from_unixtime(created_at),'%Y%m%d')=date_format(from_unixtime(t.created_at),'%Y%m%d'))as 'grade_04',
(select count(1) from tre_upgrade_log where new_
SQL多条件统计查询
最新推荐文章于 2024-06-30 07:27:16 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)