What is the best way to structure a product table where you have infinite categories and children, such as a tree? So you can do a simple autocomplete search? Thank you
What is the best way to structure a product table where you have infinite categories and children, such as a tree? So you can do a simple autocomplete search? Thank you
A possible form would be the table for categories ( tb_categorias
) containing the following columns:
If idSubCategoria = 0
, it is Parent category, if it is >= 1
then it is Son category, according to the name of each category. >
And in the product table:
Then just recover data! ;)
Tatiana , you can use " Nested Set Model " as it provides very efficient queries where each item has a single parent and zero or more children.
Maybe this might help you.