This ActiveRecord query works in SQLite:
SlotReq.group(:team_id)
In PostgreSQL, the same query gives this error "GroupingError - column slot_reqs.id must appear in the GROUP BY clause or be used in an aggregate function"
Based on the answer to this question I changed my query to:
SlotReq.select("slot_reqs.team_id").group("slot_reqs.team_id")
and it works as expected.
I would like to know if I'm doing it right and why does this work?