I want to show 0 or something i want when no data.And this is my query.
SELECT `icDate`,IFNULL(SUM(`icCost`),0) AS icCost
FROM `incomp`
WHERE (`icDate` BETWEEN "2016-01-01" AND "2016-01-05")
AND `compID` = "DDY"
GROUP BY `icDate`
And this is result of this query.
icDate | icCost
--------------------------
2016-01-01 | 1000.00
2016-01-02 | 2000.00
2016-01-03 | 3000.00
2016-01-04 | 4000.00
2016-01-05 | 5000.00
If every day i want to show data it have a data,It wasn't problem.But it have some day,It don't have data. This will not show this day, Like this.
icDate | icCost
--------------------------
2016-01-01 | 1000.00
2016-01-02 | 2000.00
2016-01-04 | 4000.00
2016-01-05 | 5000.00
But i want it can show data like this.
icDate | icCost
--------------------------
2016-01-01 | 1000.00
2016-01-02 | 2000.00
2016-01-03 | 0.00
2016-01-04 | 4000.00
2016-01-05 | 5000.00
How to write query to get this answer.Thank you.