Group By State name and employee total
Ruslan Zasukhin
sunshine at public.kherson.ua
Tue Apr 1 04:50:35 CDT 2008
On 3/31/08 3:18 PM, "Sims, John (CDC/CCHP/NCBDDD) (CTR)" <ayu8 at cdc.gov>
wrote:
>>> How do you Group by State when counting employees?
>>>
>>> Select ???(StateName), count(*) from tblEmployee Group by State
>>>
>>> I want to see something like
>>>
>>> Texas 73
>>> California 1090
>>
>> Yes, your query looks fine
>>
>> Possible actually 2 cases:
>>
>>
>> SELECT StateName, COUNT(*)
>> FROM tblEmployee
>> Group BY State
>>
>> Or
>>
>> SELECT StateName, COUNT(fld)
>> FROM tblEmployee
>> Group BY State
>>
>>
>> They differ in counting of NULL values.
>>
>>
>> --
>> Best regards,
>>
>> 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.
Really, I have miss it is different.
Of course this is correct
SELECT StateName, COUNT(*) FROM tblEmployee GROUP BY StateName
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list