I have a query like this:
SELECT SUM(spend.price) AS total, WEEKDAY(spend.date) AS weekday
FROM spend
WHERE spend.date BETWEEN '2012-11-01' AND '2012-11-07'
GROUP BY WEEKDAY(spend.date) ;
Right now the query gives me only the days in which the user had some payments.
total weekday
60 2
10 3
3 5
3 6
But instead I want to give me 0 (zeros) for every day without payments.
total weekday
0 1
60 2
10 3
0 4
3 5
3 6
0 7
Table schema here.
Here is the original syntax:
And here is the shortened one:
Here is a demonstration: http://sqlfiddle.com/#!2/8c323/3/0