sql query to check whether multiple entries exist
WITH cte AS ( SELECT Name, ID, COUNT(ID) OVER (PARTITION BY ID) cnt
              FROM source_table )
SELECT Name, ID
FROM cte
WHERE cnt &gt; 1;

SELECT DISTINCT t1.*
FROM source_table t1
JOIN source_table t2 ON t1.id = t2.id
                    AND t1.Name != t2.Name