mysql query using group by with if

I have following table structure


| class | section | month | total | cases

| 1 | A | 09 | 12 | 12

| 1 | B | 09 | 2 | 0

| 2 | A | 09 | 0 | 0

| 1 | A | 10 | 13 | 0

| 2 | A | 10 | 0 | 12

I want to write query to get the following

| class | section | total(09) | case (09) | total(10) | case(10)

1 | A | 12 | 12 | 13 | 0

1 | B | 2 | 0 | 0 | 0

2 | A | 0 | 0 | 0 | 12

It’s group by class and section but how to get the values I used if but of not much help.

I tried searching net but nothing much found, there are so many DB guys here, please help for the same.