sql join question, how to select when value not in a set of values

Posted by Elliott on Stack Overflow See other posts from Stack Overflow or by Elliott
Published on 2010-12-31T19:10:23Z Indexed on 2010/12/31 19:54 UTC
Read the original article Hit count: 241

Filed under:
|

I have two tables, table1 and table2. Table1 is in a one to many relationship with table2 (one row in table1 maps to many rows in table2). There is a field in table2 called code. If none of the values of code in table2 equal some set of values (say 1, 2, and 3), I want to select the value in table1. I'm not sure how to write this kind of join.
Assume the primary key in table1 is called id and the foreign key to which it maps is called did. Can you tell me how to write this kind of join?

Thanks,

Elliott

© Stack Overflow or respective owner

Related posts about sql

Related posts about joins