GROUPING BY multiple columns/reqs Say I have the following table:

| type        | date         | count       |
+-------------+--------------+-------------+
| cat         | 2014-2-5     |      2      |
| horse       | 2014-2-7     |      3      |
| cat         | 2014-1-28    |      1      |
| dog         | 2014-7-12    |      5      |
| cat         | 2014-9-30    |      7      |
+-------------+--------------+-------------+


I want to see how much of each type was sold each month i.e

| type  | Year      | 2014Month=1 | 2014Month=2 |2014Month=7 |2014Month=9 |
+-------+-----------+-------------+-------------+------------+------------+
| cat   | 2014      |      1      |      2      |      0     |      7     |
| horse | 2014      |      0      |      3      |      0     |      0     |
| dog   | 2014      |      0      |      0      |      5     |      0     |
+-------+-----------+-------------+-------------+------------+------------+


So far the closest thing I could come up with is to do it one month at a time e.g. for February 2014:

SELECT   type, YEAR(date), SUM(count)
FROM     myTable
GROUP BY type
WHERE    date BETWEEN "2014-2-1"
                  AND "2014-2-31";


And then manually rerun changing the dates for each month. There must be an easier way.
Have you tried this one?

Case # 1

This SQL Query only check out in February month of 2014 of all type (that is Cat,dog,horse):

SELECT   type, YEAR(date), SUM(count)
FROM     myTable 
WHERE    date BETWEEN '2014-02-01'
                  AND '2014-02-28' 
GROUP BY type 
ORDER BY type;


Case # 2

This SQL Query check out the only type cat for the month of February 2014:

SELECT   type, YEAR(date), SUM(count)
FROM     myTable 
WHERE    date BETWEEN '2014-02-01'
                  AND '2014-02-28'
AND      type LIKE '%cat%' 
GROUP BY type 
ORDER BY type;


Case 3#

This SQL Query check out all type in the year 2014:

SELECT   type, YEAR(date), SUM(count)
FROM     myTable
WHERE    date BETWEEN '2014-01-01'
                  AND '2014-12-31'
GROUP BY type 
ORDER BY type;