SELECT
a.click_date as dateTime,
ifnull( b.requestCount, 0 ) as requestCount,
ifnull( b.showCount, 0 ) as showCount,
ifnull( b.clickCount, 0 ) as clickCount,
ifnull( b.consume, 0 ) as consume
FROM
(
SELECT
curdate( ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 1 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 2 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 3 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 4 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 5 DAY ) AS click_date UNION ALL
SELECT
date_sub( curdate( ), INTERVAL 6 DAY ) AS click_date
) a
LEFT JOIN (
SELECT
DATE_FORMAT( s_t, "%Y-%m-%d" ) AS dateTime,
SUM( req_count ) AS requestCount,
SUM( show_count ) AS showCount,
SUM( click_count ) AS clickCount,
SUM( consume ) AS consume
FROM
stat_media_consume
GROUP BY
dateTime
) b ON a.click_date = b.dateTime