query recursive with parent-child table ?
777363Jun 5 2010 — edited Jun 6 2010Hi all.
I have a content_group table that has the structure :
content_group
(
content_group_id number(5),
parent_id number(5),
code varchar2(10)
)
And some data samples
content_group_id parent_id code
1 null A
2 1 B
3 2 B
4 2 B
5 2 C
6 2 C
7 3 C
8 5 D
9 5 D
10 6 D
11 7 D
12 7 D
13 7 D
I want to find all record that has code='D' is child of records that has code='C', and the records has code='C' is child of records that has code='B', and the records has code='B' is child of records that has code='A'.
With that require, i have this results :
content_group_id parent_id code
8 5 D
9 5 D
10 6 D
I want to write a procedure to do this.
Please give any ideas or suggestions.
Sorry for my English.
thanks.