oracle - how to add different column with one code into one column? -


  id text 1 Hi 1 How OK 1? 2 rad2q3  

I am searching for a query where I can put the id = 1 in a column in a column

  id Test 1 Hi how are you okay? 2 red qi  

With listgag function, I will have a result: Hi how are you okay? ..I can do this
hi
How are you
okay?

This query can be used to get your results:

  In the form of tabs (id, text) (Select 1, 'Hi' from Dual Union All Select 1, 'Select All' from Dual Union with 1, 'Ok?' Dual Union Select All , 'Raad' Select all from Dual Union 2, 'Select two from Dual Unias', Dual to Dual) ----- - End of Data ----- Selection ID, List within Group (Text, '') ( Order by ROUNUEN) by group as text in the form of tab;  

output

  id text 1 Hi how okay? 2RedQ3  

But there is a problem, although the order is used by the RUNUUM but you can not guarantee the sequence of lessons, to keep another column in your table It is better that the command of the text in the form below is

  id text sequence_text1 Hi 1 1 U2 how ok 1? 3 2 Red 1 2 Q2 3 1  

and query as

  Select ID, list (text, '') within group (ORDER) BY_text) The text of the tab by the group from the ID;  

Comments