sql question

Página superior
Adjuntos:
Obtener este mensaje como un correo
+ (text/plain)
Eliminar este mensaje
Responder a este mensaje
Autor: Mike Starke
Fecha:  
Asunto: 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