I have 2 tables like these:
category table
id category_title category_parent
---- -------------- ---------------
1 sport 0
2 electronic 0
3 football 1
4 volleyball 1
5 laptop 2
6 television 2
7 basketball 1
product table
id product_name product_category(referenced to id column from category table)
---- -------------- ---------------
1 product1 3
2 product2 3
3 product3 4
4 product4 4
5 product5 5
6 product6 6
7 product7 7
I want to get all products in a main category (for example I want to get all products from product table that their category is sub-category of sport). what is the right SQL query? (for example I want to get these products: product1, product2, product3, product4, product7 that are in football, volleyball, basketball categories. These categories are sub category of sport. So I want to get all products with sport category!)