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 > Database Server Software > MySQL > unlimited sub category levels

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-29-09, 11:20
dkrysak dkrysak is offline
Registered User
 
Join Date: May 2009
Posts: 1
unlimited sub category levels

Hi there,

I have a situation where I would like to create unlimited categories, but going unlimited levels deep.... meaning something like:


level1 cat
|
level2 cat
|
level3 cat
|
unlimited

Is this possible? I can't seem to wrap my head around how to structure the database. If I didn't need unlimited levels, I would just create a table for each category and link it with a parent id type thing.

Is this possible? Or should I just throw in the towel and decide how many levels deep to allow for, and create a table for each one?

Thanks in advance.

Dk
Reply With Quote
  #2 (permalink)  
Old 05-29-09, 12:16
healdem healdem is online now
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,260
yeah its possible

do a google on data hierarchies. I know theres some good stuff by Rudy Limeback (R937) with some SQL to retrieve upto 5 levels in one query hit

but dont' give up and try to create a table for each level.. that way the dark side lies
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 05-29-09, 12:56
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
thanks healdem, it's here --> Categories and Subcategories

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
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