Let’s say I have a query like this:
query = from(chat in Chat, where: xxx)
And another query like this:
comments = from(
chat in query,
join: comment in Comment,
on: comment.chat_id == chat.id,
select: comment
)
This works, but if I ever wanted to use the comments
query in another query, i’d get this error: (Ecto.Query.CompileError) only one select expression is allowed in query
Is there any way to rewrite the comments
query, without using :select
? Meaning the query starts like from(comment in Comment, ...)
?