[thelist] Incorrect SQL?

Joshua Olson joshua at waetech.com
Sat Apr 6 18:38:00 CST 2002

----- Original Message -----
From: "rudy" <r937 at interlog.com>
Sent: Saturday, April 06, 2002 11:35 AM
Subject: Re: [thelist] Incorrect SQL?

> the GROUP BY must list all the non-aggregate fields in the SELECT

If the column in the GROUP BY is the PK, and the non-aggregate fields in the
SELECT clause are from the same table, then you *should* be able to select
them with aggregate functions, right?  If the GROUP BY in on the PK, then
every row is returned anyways, so returning detail should not matter!  Am I
just totally off-base?  Does this logic vary from db to db?

> count(*), joshua, counts rows in each group

>From a purely intellectual standpoint, I don't like this shortcut because it
just doesn't accurately describe what is happening.  It's seems to be sort
of a hack.


More information about the thelist mailing list