Hi all.. I need help in forming a SQL Query.
My requirement is - I have the table as follows-
ID | Date | Status | Count | Company | Location |
1 | 1-1-2010 | Clear | 1 | D | E |
2 | 2-3-2010 | Clear | 2 | C | F |
3 | 1-1-2010 | Rejected | 3 | B | G |
4 | 2-3-2010 | Rejected | 4 | A | H |
Now, I want the output as follows in the sql query -
ID | Date | Jan-2010Clear | Jan-2010Rejected | Feb-20101Clear | Feb-2010 Rejected | Total |
1 |
| 1 | 3 | 2 | 4 | 10 |
2 |
|
|
|
|
|
|
3 |
|
|
|
|
|
|
| Total | 1 | 3 | 2 | 4 | 10 |
I am not able to create dynamic columns in query.
Please Help..
Thanks a lot in advance....