Hi there,
I have a categories database which should contain sub-sub-sub-categories,
something like:
Food
|
-------------Fruits
| |
| ----------Apple
| | |
| | -------------Granny
| | |
| | -------------Red
| |
| |
| ----------Lemons
| |
| |-------------yellow
| |
| -------------green
|
|-----------Vegetables...
|
|
|
Drinks
|
|
etc...
I need some nice advices to build up the categories table.
I have thought of 2 possibilities:
1) Table with ID, parent_ID and name
But it becomes a nightmare to use in terms of SQL statements to display the products
(I am then obliged to treat them one-by-one)
2) Table with ID main, ID sub1, ID sub2, ID sub3, name
Here it becomes more usable (can make general SQL statements),
but populating the categories table is a nightmare.
Any other idea?
If I had to choose beteween option 1 and option 2,
which one do you think is better/worse?
Thanks in advance!
Nobru