MySQL Forums
Forum List  »  Newbie

Re: Help rewriting subquery
Posted by: Chris Stubben
Date: April 27, 2005 10:09AM

Hi again,

This should produce the same results as your sub-query (you have id-parent links and nested sets in the same table?)

SELECT child.id, child.left_id, child.right_id, child.parent, parent.left_id, parent.right_id, count(parent_set.id)-1 as level
FROM taxonomy child, taxonomy parent, taxonomy parent_set
WHERE child.parent=parent.id AND child.left_id BETWEEN parent_set.left_id and parent_set.right_id
GROUP BY child.id ORDER BY child.left_id;


Chris

Options: ReplyQuote


Subject
Written By
Posted
April 27, 2005 05:30AM
Re: Help rewriting subquery
April 27, 2005 10:09AM
April 28, 2005 02:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.