View Single Post
Old 03-16-2011, 12:55 PM  
qw12er
Confirmed User
 
Join Date: Apr 2004
Location: Montreal
Posts: 799
Recursive Query with MySQL ?

Basicaly I need to fetch the root parent of any object child. (could be as low as 25 level deep into the tree structure.)

Is there a way to do it in mysql ? I've seen it in SQLServer with the "With" statement.

heres my db columns:

dbID idParent idChild
1 2
1 3
2 4
2 5
4 6


For example, I need to query to return 1 if I look for idChild = 6

thanks
__________________
I have nothing to advertise ... yet.
qw12er is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote