I need to convert row's into columns but year will be keep on changing, so that need to required dynamic query. Could you please help here.
Here we are calculating each 12 rows sum.
| Col1 | col2 |
| 2015 | 100 |
| 2016 | 120 |
| 2017 | 120 |
| 2018 | 110 |
| 2015 | 90 |
| 2016 | 80 |
| 2017 | 70 |
| 2018 | 20 |
Output:
| 1st year(2015) | 2nd year(2016) | 3rd year(2017) | 4th Year(2018) |
|---|
| 100 | 120 | 120 | 110 |
| 90 | 80 | 70 | 20 |