sql query; group by / having
Hello,
I'm trying out the examples given here using nested sets for dealing with hierarchical data in databases: http://dev.mysql.com/tech-resources/...ical-data.html My question's regarding the example in the section 'Find the Immediate Subordinates of a Node', which provides the following query: Code:
SELECT node.name, (COUNT(parent.name) - (sub_tree.depth + 1)) AS depth Code:
+----------------------+-------+ Code:
+----------------------+-------+ Thanks in advance. |
Nevermind, this was brought up elsewhere - http://stackoverflow.com/questions/8...ry-not-working
The working query is: Code:
SELECT node.name, (COUNT(parent.name) - (sub_tree.depth + 1)) AS dpth |
Not being a DBA, I realize this is far from optimal for large datasets. Any suggestions on how to make it so?
|
All times are GMT -5. The time now is 08:57 PM. |