Category may or may not have subcategory
Subcategory may or may not have item
Each of them can be select.
I put everything in one table like this:
ID, Name, Node, Parent
-----------------------
1, Color, 0, 0
2, Shape, 0, 0
3, Red, 1, 1
4, Green, 1, 1
5, Circle, 1, 2
6, Triangle, 1, 2
7, Rectangular, 1, 2
8, Item1, 2, 3
9, Item2, 2, 3
10, Item3, 2, 3
11, Item4, 2, 4
12, Item5, 2, 5
13, Item6, 2, 6
14, Item7, 2, 7
15, Item8, 2, 7
I want to show it as hierarchy follow this:
Color
1. Red
1.1 Item1
1.2 Item2
1.3 Item3
2. Green
2.1 Item4
Shape
1.1 Circle
1.1.1 Item5
1.2 Triangle
1.2.1 Item6
1.3 Rectangular
1.3.1 Item7
1.3.2 Item8
The way I did it before is open 3 record set - one for category (color, shape), and then another sub category (red, green, circle, triangle, rectangular), and then another one for looping items.
It's work at some point but I'm concern that it's kind of slow -- either my computer slow or because of inappropriate coding.
I used to separate category, sub category, and item to each table but it won't flexible for some of them that doesn't have item.
I wonder if this is the way that you guys do it or design it differently. Please advice.