MySQL会从其他表

MySQL会从其他表

问题描述:

我想从它看起来像 ID选择表中的数据不包括所有的ID选择|美孚|都市| BARMySQL会从其他表

还有另外一个表,其中已经选择但所有数据将被存储,以便我得到独特的结果。此表看起来像 ID | ID_from_other_table

现在我正在Stucking如果我要么使用左连接或工会? 哪一个更快,我怎样才能以正确的方式设置它?

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