Ecto.Query.intersect
You're seeing just the macro
intersect
, go back to Ecto.Query module for more information.
An intersect query expression.
Takes the overlap of the result sets of multiple queries. The
select
of each query must be exactly the same, with the same
types in the same order.
Intersect expression returns only unique rows as if each query returned
distinct results. This may cause a performance penalty. If you need
to take the intersection of multiple result sets without
removing duplicate rows consider using intersect_all/2
.
Note that the operations order_by
, limit
and offset
of the
current query
apply to the result of the set difference.
Keywords example
supplier_query = from s in Supplier, select: s.city
from c in Customer, select: c.city, intersect: ^supplier_query
Expressions example
supplier_query = Supplier |> select([s], s.city)
Customer |> select([c], c.city) |> intersect(^supplier_query)