homepage Welcome to WebmasterWorld Guest from 54.198.46.115
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
Ordering a table where the entries are nested within each other
noyearzero




msg:3939666
 6:17 pm on Jun 24, 2009 (gmt 0)

i have one table that consists of the following fields

id, parent_id, depth, priority, name

the parent_id relates to the id of another item in the table which it falls below. depth is how many folders deep the entry is. sort of like a file structure where every folder is a row in the table.

well, i want to write one query to pull all the entries and display them like a folder tree. its easy enough to pull the parents priority order by that then order by its own priority. but since the number of levels deep this can span is infinite, it would have to be a recursive subquery...if thats even possible?

at the time of entry for a new row, i could grab info from the parent and its grandparent etc and add it to a new column, but i'm not sure what info to grab or how to use that info. any ideas are appreciated!

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved