I have an issue while trying to union two queries. The queries both work well if used on their own.
However, combining them by query1.Union(query2) causes the resulting SQL statement to be invalid.
Here are the two queries:
let ofGroup (ctx: sql.dataContext) (groupId: Guid) =
query {
for person in ctx.Public.Persons do
where (person.GroupNo = Some groupId)
select person
}
let findByIds (ctx: sql.dataContext) (personIds: Guid list) =
query {
for person in ctx.Public.Persons do
where (personIds.Contains(person.personNo))
select person
}
and this is the SQL statement:
SELECT [...] FROM "public"."persons" as "person" WHERE (("person"."group_no" = @param1)) UNION SELECT [...] FROM "public"."persons" as "person" WHERE (("person"."person_no" IN ()))
I have an issue while trying to
union
two queries. The queries both work well if used on their own. However, combining them byquery1.Union(query2)
causes the resulting SQL statement to be invalid.Here are the two queries:
and this is the SQL statement:
It's missing the list of group ids.