SELECT
a.click_date Time,
IFNULL(b.total,0) as InCome
FROM
(
SELECT
DATE_SUB( CURDATE( ), INTERVAL 7 DAY ) AS click_date UNION ALL
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
DATE_SUB( CURDATE( ), INTERVAL 0 DAY ) AS click_date
) a
LEFT JOIN (
SELECT
DATE_FORMAT( transaction_time, '%Y-%m-%d' ) AS datetime,
sum( amount ) AS total
FROM