The col1 in a table that exist more than once.
SELECT Col1, COUNT (Col1) AS NumOccurrences
FROM TBL
GROUP BY Col1 HAVING (COUNT(Col1)> 1 )
You could also use this technique to find rows that occur exactly once.
SELECT Col1
FROM TBL
GROUP BY Col1 HAVING (COUNT(Col1)= 1 )
Leave a Reply