SELECT col1 FROM YourTable GROUP BY col1 HAVING COUNT(DISTINCT col2) =2 AND MIN(col2) = 1 AND MAX(col2) = 2
Or another way, expandable by more than 2 numbers
SELECT col1 FROM yourtable GROUP BY col1 HAVING MIN(CASE WHEN col2 IN ( 1, 2 ) THEN 1 ELSE 0 END) = 1 AND COUNT(DISTINCT col2) = 2
source share