Re: Using MAX with COUNT?
| From: | Dave W | Date: | Sat, 22 Jul 2006 21:14:12 +0000 |
| Subject: | Re: Using MAX with COUNT? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-42243@lists.php.net to get a copy of this message | ||
Why don't you use a where instead of a group function?
On 7/22/06, Skip Evans <skip@bigskypenguin.com> wrote:
Hey all, I have a table like this:-- Dave WboroughID Area ========= ==== 1 Chelsea 1 East Village 1 West Village 1 So Ho 2 Prospect Park 2 Brooklyn Heights 3 Prospect HeightsWhat 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(*)) FROMbsp_areaGROUP 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