The answer with group by hosts having count(distinct groups) = 3
is frequently mentioned, and it does give the right answer. But the following query also works, and usually performs much better if you have an appropriate index. The index should be on (hosts,groups)
if I recall.
SELECT t1.hosts
FROM MyTable AS t1
INNER JOIN MyTable AS t2 USING (hosts)
INNER JOIN MyTable AS t3 USING (hosts)
WHERE (t1.groups, t2.groups, t3.groups) = (1, 2, 3)
See my presentation SQL Query Patterns, Optimized for some analysis of this type of query.