Oracle SQL: Transpose / rotate a table result having one row and many columns -
i'm looking way transpose or rotate table in oracle sql. case there 1 row in select, multiple columns.
example:
select id "id", name "name", some_value "favorite color" table id = 5;
result:
id | name | some_value --- ------ ----------- 5 john orange
what see is:
id | 5 name | john favorite color | orange
i'm aware of pivot, i'm struggling see simple code case.
you can unpivot columns result follows:
select fld, val ( select to_char(id) "id", -- convert columns same type name "name", some_value "favorite color" your_table id = 5 ) unpivot(val fld in("id", "name", "favorite color"));
Comments
Post a Comment