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_