I have two tables
Table1 : Categories ,
Columns : id , parent_id , name
Table2 : products ,
Columns : id , product_name , category_id , subcategory_id , sale_wanted
Here is the detailed information. A
category can have several id subcategories. Parent id 0 means it is a category and parent id! = 0 means it is a subcategory. Now each product is associated with a subcategory. I need to display category names and the total number of subcategories related to each category. selling 0 means the product is being sold and 1 means it is necessary. Now I need it. 1. Define all categories and the number of subcategories related to each category in which goods belonging to the category are sold.
source
share