Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Select multiple row with same ID as columns

SainaaSep 21 2020 — edited Sep 21 2020

Hello I have list of data where it has same IDs but have different phone numbers. Each ID has 1~5 phone numbers so when I group them by ID some IDs return more than one row.

I want to select them as one row but values returned one new columns. For example:

ID phone_no

1    111

1    222

1    333

2    444

2    555

3    666

ID phone_no1 phone_no2, phone_no3

1  111               222               333

2  333               444               null

3  666               null               null

This is my desired output.

Actually it can be any number of phone_no I don't know max value yet but it shouldn't exceed 10.

This post has been answered by RogerT on Sep 21 2020
Jump to Answer
Comments
Post Details
Added on Sep 21 2020
3 comments
5,411 views