I have categoris table (tbl_categories)
This table is recursive one , and have 3 feilds :
CategoryID - (PM),
ParentID - (FK),
I also have products table (tbl_products) that hold CategoryID as FK.
The Category table have only 2 level (category and sub category)
How can i retrive the product feilds and the category feilds in one query for specific product?
(i need both the category and the sub category feilds).
i try this query but did not get result:
SELECT tbl1.* ,tbl2.*, tbl3.* FROM ( tbl_products AS tbl1
INNER JOIN tbl_categories AS tbl2 ON tbl1.CategoryID = tbl2.CategoryID )
INNER JOIN tbl_categories as tbl3 ON tbl2.CategoryID = tbl3.ParentID