0

I have a table as follows with 3 columns

First_Name Last_Name ID
AAA        ZZZ        3   
BBB        YYY        1   
CCC        XXX        2   

I want the outout based on the sorting order of ID value into a single row The output should look like this

BBB YYY CCC XXX AAA ZZZ

Please help me out in getting the required output.

regards sivakiran B

4
  • 1
    Do you want this as a single column or as six? what Oracle version are you using? Commented Dec 11, 2014 at 7:14
  • What about PIVOT / UNPIVOT? oracle-base.com/articles/11g/… Commented Dec 11, 2014 at 7:25
  • Hi Mureinik, I want this as six columns Commented Dec 11, 2014 at 7:54
  • Hi Leptonator, I have gone through PIVOT, but in all the forums it has explained as using with aggregate functions. So i didn;t understand that much about that Commented Dec 11, 2014 at 7:55

1 Answer 1

1

Maybe this will help you:

SELECT LISTAGG(first_name||' '||last_name, ' ') WITHIN GROUP (ORDER BY id) AS namelist
  FROM your_table;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.