1 Reply Latest reply on Dec 6, 2012 2:26 PM by Frank Kulash

    oracle 10g query rows to column transpose

      In oracle 10g I have table called LoginUser

      Select * from LoginUser where Day = '01-Dec-2012'

      will give me the below result

      Day, Name, Country
      1-Dec-12 , John, UK
      1-Dec12 , Cate, US
      1-Dec-12 , Prakash, India
      1-Dec-12 ,Juli, Pak

      But I want result as below

      Day, Name1, Country1, Name2, Country2, Name3, Country3, Name4, Country4
      1-Dec-12, John, UK, Cate, US, Prakash, India, Juli, Pak
        • 1. Pivot
          Frank Kulash

          So you have 2 columns on N rows, and you want to display that as 2*N columns on 1 row. That's called Pivoting . SQL*Plus has no features for that; you'll have to use SQL (or maybe PL/SQL, depending on your requirements) to solve it, and, if you want help, ask in the SQL and PL/SQL. The FAQ section in that forum has several very helpful items, including {message:id=9360002} and {message:id=9360005}