You want to select all rows from table1 which don't exist in table 2? Example: table1.id = list(1, 2, 3, 4, 5) table2.id = list(1, 2, 5) You want to have 3 and 4 as the result cause they are not in table 2? Use the OUTER JOIN: SELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id WHERE table2.id IS NULL