I am writing a query to check if I have got duplicates in a certain column.
SELECT COUNT(thecol) FROM thetable WHERE thecol IS NOT NULL GROUP BY thecol HAVING COUNT(*) > 1
That will give me an output like
3 5 6
Which of course is the number of records for each value of thecol where thecol is not unique.
Now how do I only get the sum 14? Should I have the existing query as a subquery?