Elixir, Ecto, Subqueries, GROUP BY
Since I’m very familiar with SQL, if I have to do something a bit more complicated with Ecto I start with the SQL and then work towards figuring out how to translate it to Ecto. It’s good to keep in mind that if the going gets too rough with the translation you are always left with the “out” of just executing raw SQL. You can map the result set into a schema and from the perspective of a programmer using the API it looks just the same.