Co potřebujete, je jednoduché coddovo relační dělení.
select distinct p.team from player p
where not exists
(select * from player p1
where not exists
(select * from player p2
where
p.team=p2.team
and
p2.gid=p1.gid))
Co potřebujete, je jednoduché coddovo relační dělení.
select distinct p.team from player p
where not exists
(select * from player p1
where not exists
(select * from player p2
where
p.team=p2.team
and
p2.gid=p1.gid))