SELECT IFNULL(b.count,0) AS `order` FROM ( SELECT DATE_SUB(CURDATE(), INTERVAL 6 DAY) AS click_date UNION ALL SELECT DATE_SUB(CURDATE(), INTERVAL 5 DAY) AS click_date UNION ALL SELECT DATE_SUB(CURDATE(), INTERVAL 4 DAY) AS click_date UNION ALL SELECT DATE_SUB(CURDATE(), INTERVAL 3 DAY) AS click_date UNION ALL SELECT DATE_SUB(CURDATE(), INTERVAL 2 DAY) AS click_date UNION ALL SELECT DATE_SUB(CURDATE(), INTERVAL 1 DAY) AS click_date UNION ALL SELECT CURDATE() AS click_date ) a LEFT JOIN ( SELECT DATE(e.`payTime`) AS `datetime`, COUNT(*) AS COUNT FROM `edu_eduorder` e LEFT JOIN `edu_course` ec ON e.`cid`= ec.`tid` WHERE e.`status`=2 AND ec.`instituId`=#{instituId} GROUP BY DATE(e.`payTime`) DESC ) b ON a.click_date = b.datetime