List student groups that have at least two members in common

```
select a.studentid, a.groupid
from membersof a
join (
  select studentid, groupid
  from membersof 
  group by groupid
  where count(studentid) >= 2) b on a.studentid = b.studentid
where a.studentid = b.studentid

```

I don't think I'm quite getting this correctly but basically, I need to find the groupID that has at least two members in common. With the query above I keep getting a "missing right parenthesis error, but I closed the join and the count, any help/guidance is appreciated.