Column Row Transpose in Oracle Sql
问题 Hi I have a simple query which give this result And I want to modify it as follows. the Name column becomes the column headers and the studentID column becomes the 1st row 回答1: WITH t AS (SELECT 1001 studentid, 'john' NAME FROM dual UNION ALL SELECT 1002, 'kane' FROM dual ) SELECT * FROM ( SELECT studentid, NAME FROM t) pivot (max(studentid) for name in ('john' John, 'kane' Kane)); 来源: https://stackoverflow.com/questions/19107174/column-row-transpose-in-oracle-sql