If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > ordering results from Celko hierarchy

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-17-02, 06:52
FSmith FSmith is offline
Registered User
 
Join Date: Mar 2002
Posts: 1
Question ordering results from Celko hierarchy

I have a table modelling a hierarchical structure in Access 2000 using Celko's model and query it with the following to display the hierarchical relationship.

SELECT COUNT(P2.kwID) AS indentation, keyword
FROM hierarchy AS P1, hierarchy AS P2, keyword
WHERE P1.lft BETWEEN P2.lft AND P2.rgt
AND keyword.ID=P1.kwID
GROUP BY keyword, p1.lft
ORDER BY P1.lft, keyword

However I should like the terms to be dispalyed in alphabetical order within each level of hierarchy, ie
A
-AA
-AB
B
-BA
--BAA
-BB
etc.

I am very new to SQL and would be most grateful if someone would point me in the right direction.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On