hello,
i have seen many ecommerce site where they have only one categoyry table and store all level of category with parent child id table structure is as follow
ID |
ParentID |
CAtegoryName |
1 |
0 |
Computer |
2 |
0 |
Camera |
3 |
1 |
HP |
4 |
3 |
Pentium 4 |
5 |
4 |
Gaming |
out put
Dropdown fill result |
Computer |
Computer > HP |
Computer > HP >Pentium |
Computer > HP >Pentium>Gaming |
Camera |
how to achive this in sql the level of category can be unlimited
so it should have recursive to list down level recursively in sql
pls advice