I need to get a list that contains a count persons number per month in last the 6 months, How can I force query to give me the months with count = 0? Like this:
table A
-----------------------------
id | name | created |
-----------------------------
1 | mark |'2014-10-01'|
2 | peter |'2014-10-02'|
3 | Roger |'2014-10-03'|
4 | John |'2014-09-02'|
5 | moyes |'2014-09-03'|
6 | david |'2014-08-04'|
The result I need to get:
----------------------------
MONTHS | YEARS | TOTAL |
----------------------------
January | 2015 | 0 |
December| 2014 | 0 |
November| 2014 | 0 |
October | 2014 | 3 |
September| 2014 | 2 |
August | 2014 | 1 |
Query I've tried so far: http://sqlfiddle.com/#!2/ef54ce/6