I have looked around for examples that are specifically like what I have but I just can't find anything. From what I've seen I'm not sure it's possible but I figured I'd ask here first.
1. Original Table
I have a table that looks like this:
+-------------+------+----------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
| Application | Year | YearTarg | JanTarg | FebTarg | MarTarg | AprTarg | MayTarg | JunTarg | JulTarg | AugTarg | SepTarg | OctTarg | NovTarg | DecTarg |
+-------------+------+----------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
| Mod | 2018 | 5700000 | 400000 | 300000 | 400000 | 600000 | 500000 | 500000 | 600000 | 500000 | 500000 | 600000 | 500000 | 400000 |
| RC | 2018 | 1700000 | 40000 | 50000 | 60000 | 80000 | 100000 | 120000 | 150000 | 180000 | 220000 | 250000 | 220000 | 230000 |
| Flow | 2018 | 2000000 | 30000 | 50000 | 20000 | 80000 | 250000 | 80000 | 70000 | 200000 | 300000 | 350000 | 200000 | 190000 |
| Non-RA | 2018 | 13400000 | 1100000 | 900000 | 1000000 | 1200000 | 1000000 | 1100000 | 1100000 | 1000000 | 1100000 | 1500000 | 1100000 | 1300000 |
| AMH | 2018 | 3500000 | 100000 | 100000 | 300000 | 200000 | 500000 | 400000 | 300000 | 500000 | 200000 | 200000 | 400000 | 300000 |
+-------------+------+----------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+---------+
2. New Table
I'd like to get the results back looking like this:
I'm really struggling, and I think part of it is the inclusion of the number 1 to represent January's numbers, 2 for February's numbers, and so on.
I need this functionality in order to join back to another table based on the month value i.e. NewTable.Month = OtherTable.InvMonth (which is just MONTH(GETDATE()))
.
Can this be done?