MySQL Forums
Forum List  »  Oracle

Support for hierarchical queries?
Posted by: Nathan Christiansen
Date: August 26, 2004 03:30PM

Which version of MySQL supports an equivalent to the Oracle "connect by" clause?

For example:

select all customerid, name, level as lev
from table t
where level > 1 and orderstatusid = 1
start with custid = 1
connect by prior customerid = referralid and level <= (9)

This query grabs all of the customers and who the customers referred, and who they in turn referred, down the "referral tree" for eight levels starting with a specific customer. This query will exclude all customers that do not have a orderstatusid of 1, and will also exclude the starting customer.

In Oracle all, level, start with, connect by, prior are all reserved words.

Thanks.

Options: ReplyQuote


Subject
Views
Written By
Posted
Support for hierarchical queries?
11297
August 26, 2004 03:30PM
6029
September 26, 2004 07:46AM


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.