SQL Filter Multiple Tables Data

Posted by Brad on Stack Overflow See other posts from Stack Overflow or by Brad
Published on 2010-05-08T21:28:10Z Indexed on 2010/05/08 23:48 UTC
Read the original article Hit count: 264

Filed under:
|
|
|

If it matters, I'm using Firebird 2.1 database.

I have three tables, one with keywords, one with negative keywords, and the other with required keywords. I need to be able to filter the data so the output has just the keywords that meat the stipulation of not being in the negative keyword list, and IF there are any required words, then it will require the results to have those keywords in the end result.

The tables are very similar, the field in the tables that I would be matching against are all called keyword.

I don't know SQL very well at all. I'm guessing it would be something like SELECT keyword from keywordstable where keyword in requiredkeywordstable and where NOT in negativekeywordstable

Just a side note, The required keywords table could be empty which would mean there are no required keywords.

Any help would be appreciated.

-Brad

© Stack Overflow or respective owner

Related posts about sql

Related posts about firebird