rows to columns

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
kailas
Participant
Posts: 21
Joined: Mon Nov 17, 2008 11:49 pm
Location: bangalore

rows to columns

Post by kailas »

source:
DAY_ID | WK_END_DT | ACT_ID|ACT_START_TIME| ACT_END_TIME| TGT_EMP_ID
2010-11-07| 2010-11-13| WRK | 22:00:00.0| 06:30:00.0| 11267
2010-11-07| 2010-11-13| BRK | 23:30:00.0| 23:45:00.0| 11267
2010-11-07| 2010-11-13| MEAL | 01:30:00.0| 02:00:00.0| 11267
2010-11-07| 2010-11-13| BRK | 04:30:00.0| 04:45:00.0| 11267

Target:
DAY_ID | WK_END_DT | WRK | BRK1 | BRK2 | BRK3 | MEAL1 | MEAL2
2010-11-07| 2010-11-13 |22:00:00.0 |23:30:00.0|04:30:00.0 | - |01:30:00.0 | -

I want to convert the data coming from source as given above into columns as shown as target. The BRK ACT_ID can have the multiple option of breaks and the MEAL activity can also have multiple meals. In practical there can be three breaks and two meals. It would be great if somebody suggest how to achieve the target output.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Search DSXchange for "vertical pivot". It's been discussed a number of times.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply