WITH t AS ( SELECT 1 cd, 'a' nm FROM dual UNION ALL SELECT 1, 'a' FROM dual UNION ALL SELECT 1, 'b' FROM dual UNION ALL SELECT 1, 'c' FROM dual UNION ALL SELECT 2, 'a' FROM dual UNION ALL SELECT 2, 'b' FROM dual UNION ALL SELECT 3, 'a' FROM dual ) SELECT cd FROM t WHERE nm IN ('a', 'b', 'c') GROUP BY cd HAVING COUNT(DISTINCT nm) = 3 ;