从表 a 中选择,其中记录不在表 b 和表 c 中
我试过像这样
select a.* from table a
left outer join b on b.index=a.index
left outer join c on c.index=a.index
谢谢
从表 a 中选择,其中记录不在表 b 和表 c 中
我试过像这样
select a.* from table a
left outer join b on b.index=a.index
left outer join c on c.index=a.index
谢谢
Whereb.index
和c.index
are 各个表中的列。
select a.* from table a
left outer join b on b.index=a.index
left outer join c on c.index=a.index
WHERE b.index IS NULL
AND c.index IS NULL
尝试
SELECT a.*
FROM a
WHERE a.`index` NOT IN (SELECT `index` FROM b)
AND a.`index` NOT IN (SELECT `index` FROM c);
尝试
select *
from table_a a
where a.index not in (select b.index from table_b b)
and a.index not in (select c.index from table_c c)
我假设您的查询为您提供了 a 中的所有记录。您现在需要做的就是添加一个where
子句:
select a.* from table a
left outer join b on b.index=a.index
left outer join c on c.index=a.index
where b.index is null and c.index is null
尝试使用异常连接:
SELECT A.* FROM TABLE A
LEFT EXCEPTION JOIN B ON B.INDEX=A.INDEX
LEFT EXCEPTION JOIN C ON C.INDEX=A.INDEX