Elixir Ecto : multiple joins and reusable/composable queries Use named bindings Ecto 3.0 added named bindings for this use case.