I'd like to be able to add a sort order to a query that uses a view of 
several different tables to build a heirarchy for navigation and is 
based on Celko's Tree-Leaf model (with some code from SecretAgents.com 
thrown in as well):
Here's what I get now from the Queries below:

Navigation
Page 1
Page 2
    subPage2.1
    subPage2.2
Page 3
    subPage3.1
    subPage3.2
...

Here is what I'd ideally like to be able to do, adding sort order:
pages                           Sort order
Page 3                                 1
    subPage3.1                       1
    subPage3.2                        2
Page 1                                 2
Page 2                                 3
    subPage2.2                        1
    subPage2.1                        2
...
So sorted by boundary to begin with and then sorted by sort order or 
sorted by sort order first then boundary?
Is this possible?

TIA

will
samples of code are below:

here is how the looks in the Content_Boundary Table (sorted by boundary)
pc_ContentID         Boundary
Page 1_ID               1
Page 1_ID               2
Page 2_ID               3
subPage2.1_ID        4
subPage2.1_ID        5
subPage2.2_ID        6
subPage2.2_ID        7
Page 2_ID               8
Page 3_ID               9
subPage3.1_ID       10
subPage3.1_ID       11
subPage3.2_ID       12
subPage3.2_ID       13
Page 3_ID              14

built by this query

<cfquery name="tree" datasource="#application.config.PrimaryDSN#">
    select        Child.pc_contentID, child.pc_ContentName_en,
                       Count(Child.startbranch) AS lvl,
                       Child.startbranch, Child.endbranch
    from        Content_Tree AS Parent, Content_Tree AS Child
    where        Child.startbranch BETWEEN Parent.startbranch AND 
Parent.endbranch
    group by    Child.startbranch, Child.pc_ContentID, 
Child.pc_ContentName_en, Child.endbranch
</cfquery>

from this view:

SELECT     B.pc_ContentID, S.pc_contentName_en, MIN(B.Boundary) AS 
startbranch, MAX(B.Boundary) AS endbranch, P.pc_ContentParent
FROM         dbo.Content_Boundary B INNER JOIN
                      dbo.PageContent_Name S ON B.pc_ContentID = 
S.pc_contentID INNER JOIN
                      dbo.PageContent_Parent P ON B.pc_ContentID = 
P.pc_ContentID INNER JOIN
                      dbo.PageContent_Active A ON B.pc_ContentID = 
A.pc_contentID
WHERE     (A.pc_contentActive = 1)
GROUP BY B.pc_ContentID, S.pc_contentName_en, P.pc_ContentParent

-- 

will

----

William H Bowen
Marketing Communications Manager
ALSTOM EAI Corporation


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to