I have three tables: categories, content_info, and content.
- The
categoriestable contains the category'sidand the ID of itsparentcategory. - The
content_infocontains two columns:entry_idfor the post's ID andcat_idfor the ID of the post's category. - The
contenttable contains multiple columns about the post - such asID,title, etc.
I have a variable in the URL called parent_id which corresponds to the parent of a category. I want to list all the POSTS (not CATEGORIES) which belong to a category with a parent of the parent_id value.
For example, say the parent_id value is 5. Each post might belong to a category with an ID of 20, but that category belongs to the parent category (whose ID is 5). I want to list all the posts who belong to categories with a parent value of whatever the current parent_id happens to be.
Is there a way of doing this with MySQL joins instead of changing the PHP?