Flattening Parent Child Hierarchy: Urgent please help

Giganews Newsgroups
Subject: Flattening Parent Child Hierarchy: Urgent please help
Posted by:  Dip (soumyadip.bhattachar…@gmail.com)
Date: 10 Aug 2006

Hi Expert,
How do I flatten a Parent Child hierarchy to regular flat data: please
provide some SQL code:

I have now:
Task_ID, Parent_Task_ID, Task_Name        Level
1        1        Project Management    1
2        1        Costing        2
3        1        Estimating        2
4        2        Task1        3
5        2        Task2        3
6        3        Task3        3
7        3        Task4        3

I want to have:

Level1            Level2        Level3
Project Management        Costing        Task1
Project Management        Costing        Task2
Project Management        Estimating        Task3
Project Management        Estimating        Task4

Please help, I am stuck!
Thanks in advance.
Soumya

Replies