Hi guys,
Stuck again. Just can't get my head around these pivots. Oracle 11g.
I need to pivot 3 rows up to 3 columns with a varying number of row items. It's the varying amount of column-to-be data that I'm having trouble with
Source
| ID | RECORD_NUMBER | ITEMS | QTY |
|---|
| 1 | 100 | widget_69 | 100 |
| 2 | 101 | widget_70 | 150 |
| 3 | 101 | widget_71 | 200 |
| 4 | 102 | widget_72 | 250 |
| 5 | 102 | widget_73 | 300 |
| 6 | 102 | widget_74 | 350 |
The Target
| RECORD_NUMBER | ITEM_1 | QTY_1 | ITEM_2 | QTY_2 | ITEM_3 | QTY_3 |
|---|
| 100 | widget_69 | 100 | | | |
| 101 | widget_70 | 150 | widget_71 | 200 | |
| 102 | widget_72 | 250 | widget_73 | 300 | widget_74 | 350 |
Any help appreciated.
NT