Forum Moderators: coopster
id, cid, value
1 , 1 , john
2 , 1 , adam
3 , 1 , frank
4 , 2 , jim
5 , 2 , frank
6 , 2 , dean
7 , 3 , adam
8 , 3 , john id, cid, value
3 , 1 , frank
4 , 2 , jim
5 , 2 , frank
6 , 2 , dean
7 , 3 , adam
8 , 3 , john
select *
from test
where id in (
select t1.id
from test_copy t1
join
test_copy t2 on
t1.value = t2.value
where t1.cid = 1
and t2.cid = 3
);