Zkuste toto - SELECT clientid FROM clients GROUP BY clientid HAVING COUNT(*) = COUNT(IF(PageID = 3, PageID, NULL));