brooksh Posted March 13, 2012 Share Posted March 13, 2012 How can I combine these two queries then how do I display the results? First I need to grab my main category SELECT DISTINCT category_name,category_id FROM db WHERE parent_id ='0' Order By category_name Then I need to grab the subcategories with the $category_id from the main category SELECT DISTINCT category_name,category_id FROM db WHERE parent_id = '$category_id' Order By category_name Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted March 13, 2012 Share Posted March 13, 2012 you could try SELECT DISTINCT category_name, catagory_id FROM db WHERE parent_id IN (0, (SELECT catagory_id FROM db as dbTemp WHERE parent_id = 0)) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.