伙计们,当我运行此查询时:
SELECT * FROM big_table big
WHERE sum_number = 1
AND NOT EXISTS ( SELECT 1
FROM smal_table smal
WHERE other_number = big.other_number
)
我得到 4 个结果,但是当我运行这个时
SELECT * FROM big_table big
WHERE sum_number = 1
AND NOT EXISTS ( SELECT 1
FROM smal_table smal
WHERE other_number = big.other_number
AND NOT EXISTS ( SELECT 1
FROM and_another_table another
WHERE and_another_number = big.and_another_number
)
)
我从 big_table 得到所有行。有谁知道为什么会发生这种情况?我想做一个查询,显示 big_table 中不存在于 smal_table 中的所有行,但如果它存在于小表中,我只想要 and_another_table 中不存在的行 谁能帮帮我?
编辑:我想要 big_table 中不在 small_table 中的行加上 big_table 中在 small_table 但不在 and_another_table 中的行