Index: openacs-4/packages/acs-core-docs/www/xml/developers-guide/tutorial-advanced.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/xml/developers-guide/tutorial-advanced.xml,v
diff -u -r1.4.2.6 -r1.4.2.7
--- openacs-4/packages/acs-core-docs/www/xml/developers-guide/tutorial-advanced.xml 9 Feb 2004 20:33:01 -0000 1.4.2.6
+++ openacs-4/packages/acs-core-docs/www/xml/developers-guide/tutorial-advanced.xml 9 Feb 2004 21:50:21 -0000 1.4.2.7
@@ -605,6 +605,32 @@
o.tree_sortkey"
+ Here's an example, pulling all of the children for a given
+ parent:
+
+
+ SELECT
+ children.*
+ FROM
+ some_table parent,
+ some_table children
+ WHERE
+ children.tree_sorktey between parent.tree_sortkey and tree_right(parent.tree_sortkey)
+ and parent.tree_sortkey <> children.tree_sortkey
+ and parent.key = :the_parent_key;
+
+
+ This example does not include the parent. To return the entire subtree including the parent, leave out the non-equals clause:
+
+
+ SELECT
+ subtree.*
+ FROM some_table parent, some_table subtree
+ WHERE
+ subtree.tree_sorktey between parent.tree_sortkey and tree_right(parent.tree_sortkey)
+ and parent.key = :the_parent_key;
+
+
If you are using the Content Repository, you get a similar
facility, but the parent_id
column is already there. Note you can do joins with