"" .
create table t ( x varchar(1), y int);
insert into t (x, y) values ('a', 1);
insert into t (x, y) values ('c', 6);
insert into t (x, y) values ('e', 3);
insert into t (x, y) values ('d', 6);
insert into t (x, y) values ('c', 4);
insert into t (x, y) values ('b', 1);
insert into t (x, y) values ('a', 5);
insert into t (x, y) values ('g', 1);
create table q ( x varchar(1) );
insert into q (x) values ('a');
insert into q (x) values ('b');
select a.y from
(
select t.y
from t join q on (t.x = q.x)
group by t.y
having count(*) = (select count(*) from q)
) a
join t on (a.y = t.y)
group by a.y
having count(*) = (select count(*) from q)
SQLFiddle.
, .
, select count(*) , IN, , , where.
select a.y from
(
select t.y
from t
where t.x in ('c', 'd')
group by t.y
having count(*) = 2
) a
join t on (a.y = t.y)
group by a.y
having count(*) = 2