Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Categories

Status
Not open for further replies.

waiterm

Programmer
May 17, 2004
236
GB
Hi,

I'm trying to develop product listings on a friends website, and have run into difficulties finding the most effiecient means of nesting the categories so that he can have infinite category levels if possible. I'm developing on a simple ASP/Access setup and basically don't want to have to flood the database with loads of joined category tables, i.e. I want

Main Category
Sub Category
Sub Sub Category
...
Products

in as few tables as possible.

Are there any tutorials available? Or does anyone have any good suggestions as to the logic I should be using as I'm struggling to picture it at the moment.

Any thoughts would be gratefully recieved.



Rob Waite
 
Howdy Rob,
I think what you are talking about is a parent child relationship in one table, if you want to use as few tables as possible.

If you have columns like
ID (autonumber), ParentID, OtherInfoFields

So the main Category would be
1, NULL, NULL
The next SubCategory would be
2, 1, NULL
The next SubSubCategory would be
3, 2, NULL

The field OtherInfoFields can be whatever fields you also need.
I am not sure if this is what you were asking, but I hope it helps.
Ksbigfoot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top