MySQL Forums
Forum List  »  Newbie

query with mapping to another table (?!)
Posted by: Alex Gunshot
Date: October 05, 2006 07:15AM

Hello,

Sorry for the stupid title. ;-) I have the following situation:

I have two tables, one with posts ('posts') that have an ID ('post_id'), and another one where the post IDs are mapped to categories ('cat_id'); this table is called 'posts2cats'. In 'posts2cats', for each 'post_id', there is one or more rows with 'cat_ID'.

Now I'm constructing a query which should select a row from 'posts' only if the post_id has an entry in 'posts2cats'. How could this part of the WHERE clause look like?

I thought this could work with JOIN or something like that, but I'm too much of an SQL-noob to get the idea.

Thanks for any hints.

Options: ReplyQuote


Subject
Written By
Posted
query with mapping to another table (?!)
October 05, 2006 07:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.