Learn about the new Oracle AI Agent Studio for Fusion Applications: Watch Now
Progress with Redwood: Redwood Resources for Oracle Cloud HCM - Go Here
Progress with Redwood: Redwood Resources for Oracle Cloud HCM - Go Here
Oracle SQL - Display rows as columns - Many to Many Relationship
Summary
Oracle SQL - Display rows as columns - Many to Many RelationshipContent
Good day! I need some guidance if I want to do is actually possible in Oracle SQL.
I have a table like this:
ID | Name | Code |
---|---|---|
999 | Abby | 1 |
999 | Betty | 1 |
999 | Cass | 2 |
999 | Diane | 2 |
999 | Elly | 2 |
999 | Faye | 3 |
999 | Greg | 4 |
999 | Honey | 4 |
999 | Iman | 4 |
999 | Jam | 4 |
999 | Klade | 5 |
And I want to achieve something like this:
ID ----- | 1 ------------ | 2 --------- | 3---------- | 4---------- | 5---------- |
---|---|---|---|---|---|
999----- | Abby---------- | Cass------- | Faye------- | Greg------- | Klade------ |
999----- | Betty--------- | Dianne----- | ----------- | Honey------ | ----------- |
999----- | -------------- | Elly------- | ----------- | Iman------- | ----------- |
999----- | -------------- | ----------- | ----------- | Jam-------- | ----------- |
I have tried joins, pivots, aggregates, but nothing seems to possibly work out (as far as I tried it.) I even tried getting all the raw data and creating a new table but the only id I can reference them with is the ID.
Tagged:
0