我有一张表,我需要碰到多个表,其中左外连接不包括右外连接。对此有最佳做法吗?先联合所有其他表?还有什么?
这是我想到的第一个想法来处理这个问题,但我想知道是否有更好更有效的方法。
select
master_table.*
from
master_table
left outer join
(
select customer_id from table_1
union
select customer_id from table_2
union
select customer_id from table_3
union
select customer_id from table_4
) bump_table
on
master_table.customer_id = bump_table.customer_id
where
bump_table.customer_id is null