RE: Using MAX with COUNT?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SELECT count(*) FROM  `bsp_area` GROUP  BY boroughID


Bastien


From: Skip Evans <skip@xxxxxxxxxxxxxxxxx>
To: Php-Db <php-db@xxxxxxxxxxxxx>
Subject:  Using MAX with COUNT?
Date: Sat, 22 Jul 2006 13:48:43 -0600

Hey all,

I have a table like this:

boroughID	Area
=========	====
1		Chelsea
1		East Village
1		West Village
1		So Ho
2		Prospect Park
2		Brooklyn Heights
3		Prospect Heights

What I want to know is which boroughID has the most area's assocated with it, and how many.

So I tried this:

SELECT max(count(*)) FROM  `bsp_area` GROUP  BY boroughID

...and got an "Invalid use of group function" error.

Anyone think of another way to do this in a single SQL statement, or some other simple method?
--
Skip Evans
Big Sky Penguin, LLC
61 W Broadway
Butte, Montana 59701
406-782-2240

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux