Finding rows that only have duplicate values in a specific column
WITH cte AS (
SELECT
colb,
COUNT(*) AS dup
FROM
sales
GROUP BY
colb
)
SELECT
cola
FROM
data
INNER JOIN cte ON data.colb = cte.colb
WHERE
cte.colb > 1;
Comments
Post a Comment