I'm stuck in a place in my current project. The problem is that I have a table called 'deal' and it has three fields.
id | date | deal_value| ------------------------------ 1 | 2014-01-03 | 200 | 2 | 2014-01-03 | 40 | 3 | 2014-02-20 | 23 | 4 | 2014-03-21 | 440 | 5 | 2014-06-18 | 256 | 6 | 2014-06-03 | 55 | 7 | 2014-12-15 | 456 |
Now the thing is that I need a sql query to get result as follows.
| month | deal_value(count) | -------------------------------- | 01 | 240 | | 02 | 23 | | 03 | 440 | | 04 | 0 | | 05 | 0 | | 06 | 311 | | 07 | 0 | | 08 | 0 | | 09 | 0 | | 10 | 0 | | 11 | 0 | | 12 | 456 |
please if anyone can, put some idea...