My first thought is to use a self-referencing table.

  Page (PageID, categoryinfo, ParentID)

   ParentID references back to PageID.  Set it to zero for top-level 
categories.

   You can get any page by selecting where pageID = currentpageID
   You can get all children by selecting where parentID = currentpageID
   You can get the parent by selecting where page.pageID in (select 
parentID where pageID = currentpageID)   (<-- or something like that)


Since you want to reference everything by a single ID set, you probably do 
not want to your pages into multiple categories.


At 09:23 AM 06/11/2001 -0500, you wrote:
>Hello. I'm trying to build an application but I'm stuck on designing the 
>DB.  I'll try to explain how the site is going to be made, and hopefully 
>someone can help.
>
>There are only going to be 3 levels of pages.  Category pages, sub pages, 
>and sub-sub pages.  I want to be able to call any page, whether it's a 
>sub-sub, sub, or category page, just by it's id (like pageid=3).
>
>Then, using only the pageid information I want to be able to get all the 
>other pages in that category... so, for example:
>
>If pageid 3 was a sub-sub page... when someone goes to that page, I want 
>to be able to list the main category page it's under, the sub pages under 
>that category, and then the sub-sub pages under the sub page (which the 
>current page belongs to).  Can anyone help me figure out how I should 
>build the DB to handle this?
>
>I feel like an idiot because it seems like it would be so simple 
>(especially since I know the pages will always be only 3 levels deep) but 
>I just can't figure out how to make the DB.  Please help!
>
>Cody
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to