I am looking for a code which can transpose row to column using the group by, below is my table and desire output.
Table:
MR_ID | DR_ID
--------|--------
MR_123 | 1
MR_123 | 3
MR_124 | 4
MR_124 | 5
MR_124 | 6
MR_125 | 0
Desire Output:
MR_ID | DR_ID_1 | DR_ID_2 | DR_ID_3
--------|----------|----------|---------
MR_123 | 1 | 2 | NULL
MR_124 | 4 | 5 | 6
MR_125 | 0 | NULL | NULL
Here I want each separate column for each DR_ID with increment of the number, this should be dynamic.