Finding duplicates in a table. Find all email addresses that exist more than one time:
SELECT customer,
COUNT(customer) AS NumOccurrences
FROM SalesTable
GROUP BY customer
HAVING ( COUNT(customer) > 1 )
Find rows that occur exactly once:
SELECT customer
FROM SalesTable
GROUP BY customer
HAVING ( COUNT(customer) = 1 )
No comments:
Post a Comment