Group By State name and employee total
barry at noodlebox.com.au
barry at noodlebox.com.au
Sun Mar 30 23:25:29 CDT 2008
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
Thanks,
Barry G. Sumpter
Manager - I.T. Development And Support
Noodle Box Pty Ltd
Unit 13A / 663 Victoria St.
Abbotsford, VIC 3067
Direct: (03) 8851-4212
Office: (03) 8851-4275
Mobile: 0448 714 172
EMail: barry at noodlebox.com.au
Web: www.noodlebox.com.au
This e-mail and any files transmitted with it are privileged and confidential information intended for the use of the addressee. The confidentiality and/or privilege in this e-mail is not waived,
lost or destroyed if it has been transmitted to you in error. If you have received this e-mail in error you must (a) not disseminate, copy or take any action in reliance on it; (b) please notify
Noodle Box immediately by return e-mail to the sender; (c) please delete the original e-mail.
Please consider the environment before printing this email
-----Original Message-----
From: valentina-bounces at lists.macserve.net [mailto:valentina-bounces at lists.macserve.net] On Behalf Of Ivan Smahin
Sent: Thursday, 20 March 2008 10:06 PM
To: Valentina Developers
Subject: Re[2]: Select distinct
Hello Mr.,
Thursday, March 20, 2008, 12:55:08 PM, you wrote:
> Hi Ivan,
> (write this one on your beer list, I will find a way ;-))
:) All the beer today is for Ruslan, for health and so on.
Happy birthday to him!
> we solved it this way (thanks to your clarification)
> select ** from tbl_indicators where recid in (select min(recid) from
> tbl_indicators group by name)
That is exactly what I mean but only note - you can not be sure
"min(recid)" produces column with name "recid" - so it is better to use alias here.
> I was a bit surprised that you can use min(recid) without stating it
> in the group by clause.
> Can you explain why this works ?
> Because it is a function (min)?
It is nature of aggregating functions - they produce the single
value for the group of records - always.
--
Best regards,
Ivan Smahin
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com
_______________________________________________
Valentina mailing list
Valentina at lists.macserve.net
http://lists.macserve.net/mailman/listinfo/valentina
E-mail message checked by Spyware Doctor (5.5.0.212)
Database version: 5.09430
http://www.pctools.com/en/spyware-doctor/
E-mail message checked by Spyware Doctor (5.5.0.212)
Database version: 5.09510
http://www.pctools.com/en/spyware-doctor/
More information about the Valentina
mailing list