Column Row Transpose in Oracle Sql

前端 未结 1 1559
感情败类
感情败类 2021-01-26 10:10

Hi I have a simple query which give this result

\"enter

And I want to modify it as

1条回答
  •  -上瘾入骨i
    2021-01-26 10:40

    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));
    

    0 讨论(0)
提交回复
热议问题