Postgres Join Query on Rails
===

I have researched a lot and I can't find the answer for my question. I have the following setup on my Rails app:


group
  has_many :people

city
  has_many :people

person
  belongs_to :city
  belongs_to :group

The people have the column role that is 0 or 1.

I want to get all the groups that have at least one person with role == 0 and one person with the role == 1

Any idea? I'm using Postgres by the way.