View Full Version : select rows where field not in table

03-19-2007, 09:42 AM
I have three tables table1, table2 and a relation (* <-> *) btween the two - table3.
to select rows from table1 i have:

SELECT table1.* FROM table1, table3 WHERE table1.field1 = table3.tbl1field1 AND table3.table2ID = 5
// 5 is an example ID from table2

How do I negate the result? Getting all rows that don't have an entry in table3 for table2ID = 5?

03-19-2007, 12:15 PM
really didn't get what you want to say?
Explain it more...

03-19-2007, 01:26 PM
sorry... anyway I fixed it... I just had a black out there... what I looked for was WHERE x NOT IN (SELECT x FROM ....)