I need help forming a select sub query.
I have a table with id,name,under_id fields. Now basically the table has
list of hierarchical categories. That is, for eg. cat D is under Cat C
and cat C is under Cat B, which is under Cat A. The under_id tell the id
under which the corresponding cat is.
table e.g.:
ID Name under_ID
1 A 0
2 B 1
3 C 2
4 D 3
5 E 2
6 F 5
Now I need a query, which can extract all the chain of a category under
it. Eg for C I should get C, B, A as result of the query.
For F, I should get F, E, B, A etc.
Can anybody help me form the query please?
thanks,
Saurabh Kumar