I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing something.
- I have 3 tables
- The set of
rolesis a static set of 9 roles
userbelongs to many
teamswith a single
If I was writing SQL by hand, I think the query would be something like:
SELECT * FROM group_user_roles gur JOIN teams t ON t.id = gur.team_id JOIN roles r ON r.id = gur.role_id JOIN users u ON u.id = gur.user_id
Or something like that…
Does anyone know how would I go about achieving something like this through Ecto?
Thanks for any responses/views!