I have a billing table where i have a PurchaseDate, ItemType, ItemSize, and other details.
billing table
+--------------------------------------------+
| PurchaseDate | ItemType | ItemSize | price |
+--------------------------------------------+
| 1-Jan-2015 | Jumper | S | 20 |
| 1-Jan-2015 | Jumper | S | 20 |
| 1-Jan-2015 | Jumper | M | 20 |
| 1-Jan-2015 | Jumper | L | 20 |
| 1-Jan-2015 | Shirt | M | 15 |
| 1-Jan-2015 | Shirt | M | 15 |
| 2-Jan-2015 | Shirt | L | 20 |
+--------------------------------------------+
...
ItemType are fixed and can be Jumper or Shirt. ItemSize are fixed and can be S, M or L.
What I need is to display a summary of purchases items ordered by PurchaseDate, followed by counts of every combination that exist for each date.
example output
+----------------------------------------------------------------------------------+
| Date | Jumper[S] | Jumper[M] | Jumper[L] | Shirt[S] | Shirt[M] | Shirt[L] |
+----------------------------------------------------------------------------------+
| 1-Jan-2015 | 2 | 1 | 1 | 0 | 1 | 0 |
| 2-Jan-2015 | 1 | 5 | 0 | 1 | 3 | 3 |
| 3-Jan-2015 | 0 | 0 | 0 | 0 | 0 | 0 |
| 4-Jan-2015 | 0 | 3 | 1 | 1 | 2 | 2 |
+----------------------------------------------------------------------------------+
Is this possible using a mysql query?