sql question

トップ ページ
添付ファイル:
Eメールのメッセージ
+ (text/plain)
このメッセージを削除
このメッセージに返信
著者: Mike Starke
日付:  
題目: 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