http://qs321.pair.com?node_id=558800


in reply to tree-oriented query against table-oriented data

...whether such a query syntax exists as either a published spec...

(I'm assuming you're after SQL syntax here, tho its not explicitly stated)

Tho not directly Perl related, there are implementations, and (conveniently) O'Reilly appears to have provided an answer as an online sample chapter for the SQL Pocket Guide.

You may also find that careful use of GROUP BY will accomplish much of what you're trying to do, albeit with some duplicate info in the rows.

A quick Google of "sql hierarchical queries" generates quite a few related hits, as does "sql tree queries", so you've got some websifting to do...

  • Comment on Re: tree-oriented query against table-oriented data