michael wrote:
...
Cat_ID int Cat_Nm varchar(xx) SubCatOf_ID int That way, if it is a main category it has NULL as SubCatOf_ID so you display it, the you loop through the values that have SubCatOf_ID = Cat_ID and so forth. This way you save space and can have unlimited subcategories.
... |
This might be a bit late, but...
When implementing what Michael posted above, you can get an unlimited depth as well.
e.g. Programs >> Utilities >> Compression >> Non-Lossey >> Command Line >> ETC...
What you do is keep the top level as NULL and for each sub or sub-sub category you add it to one or more categories or sub-categories. Depending upon what sort of speed you want, either an SP or an SP and a custom component would work best. You can insert all multiple entries for each sub-cat - i.e. the sub-cat belongs to sub-cat1, sub-cat3, and sub-cat14. Also add it to sub-cat5 if sub-cat14 belongs to sub-cat5. That creates a lot of records though. A custom component would let you do that ordering much faster than ASP would. So when you look through sub-cat5, you get it because sub-cat14 is a subset of sub-cat5 and your item belongs to sub-cat14. This can get rather messy though. A semi-real-time approach may work better, i.e. write an admin page that publishes (writes a file, e.g. my_list_x.inc) an include only when you choose to update it. If you are adding things administratively, then this may be a better approach than the mess I described above. The end result is that you do your query once a day versus whenever a new visitor request the page.
Hope that wasn't too much of a tangent...