获取在where子句中使用的联接值模式

问题描述 投票:0回答:1

是否可以使用联接值模式用于where子句?

filtered = [name: "show", name: "comedy"]
query = from s in Core.Serie, join: t in assoc(s, :tags), where: ^filtered 

结果是下一个

#Ecto.Query<from s in Core.Serie, join: t in assoc(s, :tags),
 where: s.name == ^"show" and s.name == ^"comedy">

我需要使用标签架构来匹配正确的记录,但默认情况下使用Serie架构。例如

#Ecto.Query<from s in Core.Serie, join: t in assoc(s, :tags),
 where: t.name == ^"show" and t.name == ^"comedy">
elixir ecto
1个回答
0
投票

我怀疑t.name == ^"show" and t.name == ^"comedy"首先是您想要的,主要是因为它永远不匹配(name不能同时是"show"

© www.soinside.com 2019 - 2024. All rights reserved.