Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

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, 07: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

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