Hello, I have the following table:
----------------------
downloads | data
----------------------
10 | 2016-12-01
15 | 2016-12-02
20 | 2017-01-01
30 | 2017-02-01
40 | 2017-03-01
That way I can add the number of downloads for the current month:
SELECT downloads, data,
SUM(downloads) AS soma
FROM tabela
WHERE MONTH(data) = MONTH(NOW());
My question is, I would like to select the current month and the previous 3:
12/2016: 25 Downloads
01/2017: 20 Downloads
02/2017: 30 Downloads
03/2017: 40 Downloads