sql question

Top Pagina
Bijlagen:
Bericht als e-mail
+ (text/plain)
Delete this message
Reply to this message
Auteur: Mike Starke
Datum:  
Onderwerp: sql question
On Thu, Mar 27, 2003 at 03:25:50PM -0700, wrote:
/_SELECT a, COUNT(a) AS b FROM tbl WHERE b > 1 GROUP BY a
/_should be
/_SELECT a, COUNT(a) AS b FROM tbl GROUP BY a having b > 1
/_
/_where clauses cannot act on aggregate functions (count, sum, avg, etc).
/_to filter on aggregate functions you must use the having clause
/_
/_HTH,
/_Peter

Why do I keep forgeting that? Thanks for the explanation.

-Mike