Re: MySQL query... count?
| From: | Jason Wong | Date: | Mon, 01 Mar 2004 11:03:24 +0000 |
| Subject: | Re: MySQL query... count? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33224@lists.php.net to get a copy of this message | ||
On Monday 01 March 2004 18:53, Tristan.Pretty@risk.sungard.com 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.
*/