I have this table.
+------+-------+--------+
| CODE | MONTH | AMOUNT |
+------+-------+--------+
| 2 | 1 | 100 |
| 3 | 1 | 200 |
| 2 | 2 | 300 |
| 3 | 2 | 400 |
+------+-------+--------+
And, this is the result that I'm trying to get.
+------+---------+---------+
| CODE | MO1 | MO2 |
+------+---------+---------+
| 2 | 100 | 300 |
| 3 | 200 | 400 |
+------+---------+---------+
I know that looping within select isn't possible.
I imagine I could maybe use CASE
but I don't have a definite count of months
as in my example above wherein there are only data for the months of January
and February. I would have data for March later on. How can I do this?