I store multi level category. The table look like this:
Categories Table
+-------------+---------------+--------------------+
| category_id | category_name | parent_category_id |
+-------------+---------------+--------------------+
| 1 | Clothing | NULL |
| 2 | Footwear | NULL |
| 3 | Men | 1 |
| 4 | Women | 1 |
| 5 | Shirts | 3 |
| 6 | T-Shirts | 3 |
| 7 | Jeans | 3 |
+-------------+---------------+--------------------+
company_category_mapping Table
+------------+------------+-------------+
| cmp_cat_id | company_id | category_id |
+------------+------------+-------------+
| 1 | 7 | 5 |
| 2 | 7 | 6 |
| 3 | 7 | 7 |
+------------+------------+-------------+
I want to fetch all category, sub-category, sub-sub-category from category table with respect of company_id. I am confused how do this. can i create a new table for store company category?
I want to display output in drop-down. I have three drop-down one is main category dropdown, second is sub-category drop-down and third is sub-sub-category drop-down. Drop-down is fill companies wise i.e different company has different category.
Output display screen.
Sorry for my English.
Thanks for helping me.