I have these registers in mysql (also in postgresql):
Venta
date amount
01/02/2015 7
10/02/2015 8
10/02/2015 9
20/03/2015 4
20/03/2015 11
25/04/2015 1
So, I would like to make a query where I get the total amount per day and if an amount in the day doesn't exist, display the day with 0. Something like this:
date amount
01/01/2015 0
02/01/2015 0
03/01/2015 0
04/01/2015 0
05/01/2015 0
06/01/2015 0
. . . .
. . . .
01/02/2015 7
. . . .
. . . .
10/02/2015 17
. . . .
. . . .
20/03/2015 15
. . . .
. . . .
25/04/2015 1
. . . .
. . . .
30/12/2015 0
31/12/2015 0
How can I make the query without using function? I heard that views are the best way, but I have not idea how to make it.