I have a product category table with the following fields:
cat_id (PK)
Cat_name
Cat_desc
Parent_Cat_Id
Now when a user wants to add a product he should be able to select multiple categories from a listbox(multiselection enabaled). But to let the user know the hierarchy of the categories, I need to display them in the following style:
parent category 1
parent category 1->sub category 1
parent category 1->sub category 1->sub-sub category 1
parent category 1->sub category 1->sub-sub category 2
parent category 1->sub category 2
Parent category 2
...
I know that to achieve this I need to use recursive programming. But how can we do it via stored procedures? That would be much more efficient, right?
Thanks in advance for your kind help.