therealwesfoster Posted August 10, 2008 Share Posted August 10, 2008 Ok, there are 3 tables. 1. Categories 2. Posts (goes under the categories) 3. Relation (links the posts to the category). I need help constructing a query that will select the post_id from the "posts" table WHERE post_title="THIS_TITLE" AND post_category (the category ID must come from the relation table) ="THIS_CATID". Usually (if the category id was insite the posts table) I would do something like this: SELECT post_id FROM posts WHERE post_title="TITLE" AND post_category="CATID" . But since there isn't a column in the posts table named "post_category", I need the query to check in the "Relation" table in order to get it. This is for wordpress if that makes any difference (you can see how their DB structure is) Wes Quote Link to comment Share on other sites More sharing options...
fenway Posted August 11, 2008 Share Posted August 11, 2008 You mean a JOIN? 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.