0
我試圖建立在阿雷爾以下查詢:爲什麼Arel在構建SQL時刪除「左外連接」?
select a.* from (first nested query) as a
left outer join (second nested query) as b
on a.id = b.id
where b.id is null;
這是我最好的嘗試:
query = a.
project(a[Arel.star]).
from(a_nested_sql).
join(b_nested_sql, Arel::Nodes::OuterJoin).
on(a[:id].eq(b[:id])).
where(b[:id].eq(nil))
但持續下降的「左外連接」產生無效的SQL:
select a.* from (first nested query) as a
(second nested query) as b
on a.id = b.id
where b.id is null;
我在做什麼錯?