Re: MySQL query... count?

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

 



On Monday 01 March 2004 18:53, Tristan.Pretty@xxxxxxxxxxxxxxxx wrote:

> What I need to do for a new report, is say how many downloads were
> recorded for each Business unit?
>
> I can select the Business units using Distinct, but hhow can I then count
> them?
> I've tried:
> SELECT DISTINCT(bu)buname, COUNT(buname)bucount FROM $table_name
>
> But it doesn't work.. am I being dumb on this cold Monday morning?

Don't use DISTINCT, use GROUP BY.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
One thought driven home is better than three left on base.
*/

-- 
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