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!

IDENTIFY UNIQUE ROW IN TABLE WHILE USING PIVOT AND GROUP BY

User_N31VHAug 1 2022

Hi,
I need help with identifying unique row after fetching data using pivot and group by.

Data in table Table_1:
ID is the primary key in table
Delivery_id + Role_id also identifies a unique row in the table

ID | Project | Deliverable | Role |FTE_Days | Delivery_ID | Role_ID

  1. | p1 | D1 | R1 | 1 | 11 | 10
  2. | p1 | D1 | R2 | 5 | 11 | 11
  3. | p1 | D2 | R1 | 1 | 13 | 10

In UI, data is displayed as below from table_1 (using pivot and group by):
Pivot over 'Role' and Group by 'Deliverable'
Project | Deliverable | Role R1 | Role R2
p1 | D1 | 1 | 5
p1 | D2 | 5 |

Now when user edits Role R1:
Project | Deliverable | Role R1 | Role R2
p1 | D1 | 2 | 5
p1 | D2 | 6 |

DB data:
ID | Project | Deliverable | Role |FTE_Days | Delivery ID | Role ID

  1. | p1 | D1 | R1 | 2 | 11 | 10
  2. | p1 | D1 | R2 | 6 | 11 | 11
  3. | p1 | D2 | R1 | 1 | 13 | 10

Comments

Post Details

Added on Aug 1 2022
2 comments
224 views