Answers for "select id not in another table sql"

SQL
1

sql select where id not exists in another table

where ID not in(select ID from T2 where HISTORY_FLG!=1)
Posted by: Guest on May-20-2020
0

sql values not in another table

-- Find missing t1 values in t2 (based on 'id' field)
SELECT * FROM t1 WHERE t1.id NOT IN (SELECT id FROM t2);
-- or
SELECT * FROM t1 WHERE NOT exists (
    SELECT NULL FROM t2 WHERE t2.id = t1.id
);
-- or
SELECT t1.* FROM t1 LEFT OUTER JOIN t2 ON t2.id = t1.id WHERE t2.id IS NULL;
Posted by: Guest on April-22-2021

Code answers related to "select id not in another table sql"

Code answers related to "SQL"

Browse Popular Code Answers by Language