View Single Post
Old 03-16-2011, 06:58 PM  
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Quote:
Originally Posted by qw12er View Post
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
Can't tell what you're trying to accomplish with that table. Seems to be missing data.

Regardless, it sounds like you real problem is that the DB design sucks and you'd just have to do multiple queries..
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote