Hi,
I need help from gurus here on how to transform a table with parent and child column to a horizontal result. Please refer to example below:
Code:
Hierarchy Parent Child
SUNACCT * 1100000
SUNACCT 1100000 1110000
SUNACCT 1110000 1111000
SUNACCT 1111000 1111100
SUNACCT 1111100 1111110
SUNACCT 1111100 1111120
SUNACCT 1111100 1111130
SUNACCT 1111000 1111200
SUNACCT 1111200 1111210
SUNACCT 1111200 1111220
SUNACCT 1111200 1111230
to a horizontal result set below:
Code:
Hierarchy Lvl 1 Lvl 2 Lvl 3 Lvl 4 Lvl 5
SUNACCT 1100000 1110000 1111000 1111100 1111110
SUNACCT 1100000 1110000 1111000 1111100 1111120
SUNACCT 1100000 1110000 1111000 1111100 1111130
SUNACCT 1100000 1110000 1111000 1111200 1111210
SUNACCT 1100000 1110000 1111000 1111200 1111220
SUNACCT 1100000 1110000 1111000 1111200 1111230
*note: the first line are headers.
Kindly advise how to transform the result set as shown above. I plan to save the result set to a view so that the structure can be read from an import tool.
Thanks!