0

I have a table as below.

Id  |   Number
--------------       
1   |  123    
1   |  456    
2   |  789 
2   |  321 
2   |  444

I want it like below

Id  |    Number_1  |   Number_2    |    Number_3
------------------------------------------------
1   |   123        |     456       |     null
2   |   789        |    321        |      444
zarruq
  • 2,445
  • 2
  • 10
  • 19
shylesh
  • 11
  • 2
  • How do you decide that, for example, for `id=2`, the value `789` is to be in the `Number_1` column, and not in the `Number_2` or `Number_3` column? Just don't say "they should be inserted in order"; regardless of the order in your sample data, rows in a table have as much order as nuts in a basket full of nuts. –  Sep 06 '17 at 16:19
  • i think thats one of the most frequent asked questions on stackoverflow – Esteban P. Sep 06 '17 at 16:20
  • Then: What is your Oracle version? This is important especially for pivoting questions - different versions added new tools for it. In any case, I will find an old thread with the same question; yours will then be closed as a "duplicate". Did you attempt a search before posting your question? –  Sep 06 '17 at 16:20
  • the version is 11g – shylesh Sep 06 '17 at 16:23
  • @EstebanP. - it is certainly "up there" with questions about aggregating values into strings and its reverse operation, splitting comma-separated strings into components. –  Sep 06 '17 at 16:32

0 Answers0