Re: MySQL query... count?

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

 



Perfect...
I finally used..
SELECT DISTINCT(bu), COUNT(bu) FROM $table_name WHERE date BETWEEN 
'$date1' AND '$date2' group by bu

(I added the Distinct(bu) bit, to label the results correctly... god I 
love this list)

Have a great day!




Jason Wong <php-db@xxxxxxxxxxxx> 
01/03/2004 11:03

To
php-db@xxxxxxxxxxxxx
cc

Subject
Re:  MySQL query... count?






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





*********************************************************************
The information contained in this e-mail message is intended only for 
the personal and confidential use of the recipient(s) named above.  
If the reader of this message is not the intended recipient or an agent
responsible for delivering it to the intended recipient, you are hereby 
notified that you have received this document in error and that any
review, dissemination, distribution, or copying of this message is 
strictly prohibited. If you have received this communication in error, 
please notify us immediately by e-mail, and delete the original message.
***********************************************************************

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