On 26-Jul-2001 Graham Nichols wrote:
> Hi,
> 
> I'm using MYSQL version 3.22.32. I have read that from version 3.23.xx COUNT
> can be used in combination with DISTINCT. However, I have a project deadline
> which does not give me time to upgrade.
> 
> I have a small table 'web-stats' consisting of the following fields:
> 
> IP_address
> web_date
> web_time
> web_referer
> browser
> page
> 
> I am using a PHP script to insert entries into this table as a rudimentary
> hit counter.
> My current syntax is
> 
> select web_date, dayofmonth(web_date) as d, count (IP_address) as c from
> web_stats group by d order by web_date
> 
> but what I actually want is to count the unique IP addresses for each date.
> How can I work around this please?
> 
> kind regards,  Graham Nichols.
> 

select web_date, dayofmonth(web_date) as d,IP_address as ip,count(*) as cnt
from web_stats group by web_date, ip;

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.
                            (53kr33t w0rdz: sql table query)

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to