Jump to content

How can I combine these two queries into one?


brooksh

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.