Jump to content

Query Help


therealwesfoster

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/119065-query-help/
Share on other sites

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.