Query where there are only two rows with specific data
You don't need self-joining or subqueries at all. This query does the trick:

select
id
from
your_table t
group by id
having sum(name = 'John') + sum(name = 'Jill') = 2 and count(*) = 2;



see it working live in an sqlfiddle


name = 'whatever' in the sum() function returns 1 or 0, true or false.