Also be aware of this: Group by fragment incorrectly raises grouping_error column must appear in the GROUP BY clause · Issue #3159 · elixir-ecto/ecto · GitHub
I haven’t read the issue in detail, but looks suspiciously similar to the query I’ve suggested you to run, so worth keeping that in mind.


















