Oracle Rows to Column Transformation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madristaa
    New Member
    • Mar 2012
    • 1

    Oracle Rows to Column Transformation

    Hi, I have a table

    select * from table

    values returning are

    login id | status_name | count
    =============== =============== =
    admin open 3
    admin closed 5
    test inprogress 10
    test open 10
    test closed 11
    user1 closed 5
    user1 pending 10

    how can i transfer this data from row to column?
    I want in this manner

    login_id | open | closed | inprogress | pending |
    =============== =============== =============== ====
    admin |3 |5 | 0 | 0
    test |10 |10 | 10 | 0
    user1 |0 |5 | 0 | 10
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Starting in oracle 11g, you have access to the pivot clause. For versions before that, you will have to use a series of case statements to segment out your data.

    Comment

    Working...