I have a table like this:
I want to execute the following SELECT statements:
SELECT count(*) from table WHERE A=1 and date between 2013-02 and 2013-03
SELECT count(*) from table WHERE A=1 and date between 2013-03 and 2013-04
SELECT count(*) from table WHERE A=1 and date between 2013-04 and 2013-05
....
SELECT count(*) from table WHERE B=1 and date between 2013-02 and 2013-03
SELECT count(*) from table WHERE B=1 and date between 2013-03 and 2013-04
SELECT count(*) from table WHERE B=1 and date between 2013-04 and 2013-05
...etc
What's the fastest query and can I have the results arranged in a table like:
date |A=1 |B=1 |C=1 |...
2013-Feb|count|count|count|
2013-Mar|count|...