I think this does what you are looking for (more efficiently) SELECT disticnt PolicyNumber FROM tblClassCodesPlazaCommercial where not exist ( select 1 from tblClassCodesPlazaCommercial where ClassCode NOT IN (@ClassCode) ) Original code SELECT PolicyNumber FROM tblClassCodesPlazaCommercial GROUP BY PolicyNumber HAVING COUNT (CASE WHEN ClassCode NOT IN (@ClassCode) THEN 1 END) = 0