MySql select 通过排除另一个 table 的所有 id

MySql select by excluding all id from another table

我想要 select 来自 table 的数据,看起来像 ID|FOO|CITY|BAR

还有另一个 table 所有已经 selected 的数据都将被存储,以便我得到独特的结果。这个 table 看起来像 ID|ID_from_other_table

现在我在纠结是应该使用左连接还是联合? 哪个更快,如何正确设置?

left join 在 MySQL 中 可能 not innot exists 等其他反连接模式更快。

select t1.*
from table1 t1
left join table2 t2 on t1.id = t2.id_from_other_table
where t2.id is null