select from one table where not on the other
SELECT id FROM a.table
WHERE id NOT IN (SELECT b.id FROM b.id)
select from one table where not on the other
SELECT id FROM a.table
WHERE id NOT IN (SELECT b.id FROM b.id)
join to find results not in another table
SELECT t1.name
FROM table1 t1
LEFT JOIN table2 t2 ON t2.name = t1.name
WHERE t2.name IS NULL
sql select where id not exists in another table
where ID not in(select ID from T2 where HISTORY_FLG!=1)
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;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us