How do I sum up a column from an inner query like this? Obviously this doesnt work but it is essentially what I am trying to do. There are a lot of similar posts to this but this is unique in that mine has a HAVING clause.
SELECT SUM(cnt)
FROM
(
SELECT COUNT(*) as cnt
FROM users
GROUP BY email
HAVING COUNT(*)>1
)
What you wrote should work provided you have an alias for your query
SQL Fiddle