sql question

Forside
Vedhæftede filer:
Indlæg som e-mail
+ (text/plain)
Slet denne besked
Besvar denne besked
Skribent: Mike Starke
Dato:  
Emne: 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