I have a big SQL that produces similar output, like this simplified example:
SELECT 5 AS L0, 2 AS L1, 3 AS L2, 4 AS L3 FROM DUAL
current output is a line:
| L0 | L1 | L2 | L3 | | 5 | 2 | 3 | 4 |
The desired output is the following columns:
| kind | value | | 0 | 5 | | 1 | 2 | | 2 | 3 | | 3 | 4 |
I know I can get this by combining select 4 times. I am looking for advice if unification is the best I can do here, and if this way out can be achieved by other means.
I also found many examples to invert a column into a row, but here I am looking for inversion from row to column.
source share