why not just write your query using a connect by?

-----Original Message-----
From: Costas Piliotis [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 12, 2002 3:39 PM
To: CF-Talk
Subject: RE: Sorting a grouped tree...


So to understand, you are using the Nested Tree Model or the Adjasency List
model for building your tree?

If you're using the Nested Tree Model, there is a way to do it, but from
what I've read in Selko's SQL for smarties, it seems to involve rebuilding
your tree to reorganize it into the model in the correct order.  From what I
understand, the Nested Tree Model depends heavily on the orderring of the
data in the lft and rgt columns.

Definitely a downfall to that model :(



-----Original Message-----
From: Ian Lurie [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 12, 2002 2:21 PM
To: CF-Talk
Subject: Sorting a grouped tree...


Hi all,

I'm using the nodes/tree methodology to create a grouped set of data:

        Home
          Page 1
          Page 2
        Section 1
          More stuff
          A bit more stuff
        Section 2
          Another group of stuff

Problem is, I figure out how to alphabetize, but preserve the grouping. That
is, sort top-level nodes alphabetically, and then sort their subnodes, while
preserving the tree structure.

Here's the query:

<cfquery name="caller.getallnodes" datasource="#request.datasource#">
        SELECT child.nodeid, child.nodename, COUNT(child.startbranch) AS
lvl,
        Child.startbranch, Child.endbranch
        FROM nodes_tree AS Parent, nodes_tree AS Child
        WHERE Child.startbranch
        BETWEEN parent.startbranch AND Parent.endbranch
                <cfif isdefined("getbranch.recordcount") AND
getbranch.recordcount GT 0>
                        AND child.startbranch >= <cfqueryparam
cfsqltype="CF_SQL_INTEGER" value="#getbranch.startbranch#">
                        AND child.endbranch <= <cfqueryparam
cfsqltype="CF_SQL_INTEGER" value="#getbranch.endbranch#">
                </cfif>
        GROUP BY Child.startbranch, Child.nodeid, Child.nodename,
Child.endbranch </cfquery>

Any help would be great,

Thanks,

Ian

Portent Interactive
Helping clients build customer relationships on the web since 1995
Consulting, design, development, measurement
http://www.portentinteractive.com Talk with us:
http://projects.portentinteractive.com



______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to