csak kutya és cica:
select count(distinct nev) from tabla where
nev in (select distinct nev from tabla where nev in
(select distinct nev from tabla where allat = 'kutya') and allat = 'cica') and nev not in (select distinct nev from tabla where allat not in ('kutya','cica'))
a többi esetet rádbízom.
[ Szerkesztve ]
Thank you to god for making me an atheist