"Ronan Lucio" <[EMAIL PROTECTED]> wrote on 05/16/2005 04:21:17 PM:

> Mathias,
> 
> > Hi,
> > look at group by ... with rollup at :
> > http://dev.mysql.com/doc/mysql/en/group-by-modifiers.html
> 
> Thank you very much for your help.
> 
> My needs arenīt this, exactly.
> 
> GROUP BY WITH ROLLUP, returns me several lines of the
> same day (one per IP), plus the total.
> 
> I need that every year-month-day-ip be counted as 1. And I
> need this total per day.
> 
> Thank you,
> Ronan 
> 
> 
> 

This should give you how many unique IP addresses were used and the total 
number of accesses for each day for the 5th month of 2005:

 SELECT year, month, day,COUNT(DISTINCT IP), COUNT(*) AS access
 FROM access
 WHERE year = 2005
   AND month = 5
 GROUP BY year, month, day
 ORDER BY year, month, day;

The DISTINCT keyword eliminates all duplicates so that you only count how 
many different values appear in that column. Is this what you are looking 
for?

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Reply via email to