mysql query - 5 minutes time intervals

mysql query - 5 minutes time intervals

am 05.07.2006 11:59:16 von Robbo

I have a table where I log activities on the website. Each page retrieval is
being logged to this table. I have the IP address and the timestamp when the
page was retrieved.

I assume that the number of people currently on site users is being
calculated as :


$results = mysql_query("SELECT ip FROM logg WHERE
retrieved_time>DATE_SUB($current_time,INTERVAL 5 MINUTE) GROUP by ip;");
$users_on_site = mysql_num_rows ($results);

So it tells me how many users are currently viewing the site (assuming that
each visitor stays 5 minutes on site).

Now I would like to perform a query that would check in the past when was
the time that there were more than 5 or e.g 10 users on the site(assuming
that visitors within 5 minutes interval are known as "currently viewing the
page").
Or a query that shows results sorted by max_current_users with dates.

Any advice?

--
rb