Get Started with Redwood for Oracle Cloud HCM Begin Now
To ensure that questions get required attention from community members and are NOT left unanswered, it’s important for the author to indicate (by selecting “Yes” or “No” when prompted) whether the question was answered. (newly added) Please note that it is also important to respond to EACH comment your question receives. Your Yes or No response ensures an accurate status for your question.
For more information, please refer to this announcement explaining best practices for getting answers to questions.
For more information, please refer to this announcement explaining best practices for getting answers to questions.
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