title: Postgres many-to-many relation: finding rows all having relation to a set of rows from related table
body: <p>Consider three tables, let's call them <code>groups</code>, <code>subgroups</code>, <code>another_groups</code> and table <code>subgroups_another_groups</code> that is specifying many-to-many relation between <code>subgroups</code> and <code>another_groups</code>. <code>subgroups</code> and <code>groups</code> are in one-to-many relation, so <code>subgroups</code> has foreign key <code>group_id</code>.</p>
  
  <p>How is it possible to select <code>another_groups</code> that all of <code>subgroups</code> within a <code>group</code> have relation to?</p>