我编写此查询来查找不在佛罗里达州的所有记录。
query =
from papa in Papa,
inner_join: account in assoc(papa, :account),
inner_join: location in assoc(account, :locations),
where: account.email == ^"[email protected]",
where: papa.status == ^"active",
where: location.papa_id == papa.id, <--- Some of these Papas have ZERO locations.
where: location.state != ^"FL",
group_by: [papa.id, location.state, account.id],
distinct: [papa.id],
select: [
papa.id,
papa.member_id,
papa.full_name,
account.id,
account.full_name,
location.state,
papa.status
]
它正确返回了在佛罗里达州没有任何地点的所有Papa记录。不幸的是,它跳过了实际上没有位置记录的Papa记录。
如何在Ecto查询中也包含这些记录?