> -----Original Message----- > From: valentina-bounces .at. lists DOT macserve.net=20 > [mailto:valentina-bounces@lists.macserve.net] On Behalf Of=20 > Ruslan Zasukhin > Sent: Monday, March 31, 2008 3:42 AM > To: valentina .at. lists DOT macserve.net > Subject: Re: Group By State name and employee total >=20 > On 3/31/08 6:25 AM, "barry@noodlebox.com.au"=20 > <barry .at. noodlebox DOT com.au> wrote: >=20 > Hi Barry, >=20 > > How do you Group by State when counting employees? > >=20 > > Select ???(StateName), count(*) from tblEmployee Group by State > >=20 > > I want to see something like > >=20 > > Texas 73 > > California 1090 >=20 > Yes, your query looks fine >=20 > Possible actually 2 cases: >=20 >=20 > SELECT StateName, COUNT(*) > FROM tblEmployee > Group BY State >=20 > Or=20 >=20 > SELECT StateName, COUNT(fld) > FROM tblEmployee > Group BY State >=20 >=20 > They differ in counting of NULL values. >=20 >=20 > --=20 > Best regards, >=20 > Ruslan Zasukhin > VP Engineering and New Technology > Paradigma Software, Inc
Shouldn't it be
SELECT StateName, COUNT(*) FROM tblEmployee GROUP BY StateName
And not "BY State"? Since, in the original example, StateName is not contained in an aggregate function or the GROUP BY clause, I would expect these queries to fail.
-John=20
_______________________________________________ Valentina mailing list Valentina@lists.macserve.net http://lists.macserve.net/mailman/listinfo/valentina
©2008 Sims, John (CDC/CCHP/NCBDDD) (CTR) |