I have a table of orders with these columns: order_item order_category order_date so the data looks like so:
order_item order_category order_date
1235 hardware 2014-01-07
1349 bedding 2014-01-07
1636 hardware 2014-01-08
etc.
There are about 20 product categories. This query gets me how many items were ordered by category each day:
SELECT order_date, count(order_item) as num, order_category
FROM orders
GROUP BY order_date, order_category
I would like to get a result that shows month and the count for each category, so it would look like this:
month bedding hardware etc
2013-12 5 8
2014-01 9 0
Can I do this with mysql?