How do I do a WHERE on the COUNT(name) produced by a GROUP BY clause?

Posted by ssg31415926 on Stack Overflow See other posts from Stack Overflow or by ssg31415926
Published on 2010-04-12T06:04:51Z Indexed on 2010/04/12 6:13 UTC
Read the original article Hit count: 200

Filed under:

WHERE gets processed before GROUP BY in the SELECT statement. How can I use WHERE on the result of a COUNT(name)?

What I want is this:

SELECT topic, COUNT(name) AS counter
FROM blah
GROUP BY name
WHERE counter <> 1

© Stack Overflow or respective owner

Related posts about sql