mysql - Query-clicks per 5 minutes -


i building report identify number of visitors click on specific buttons on site. after analyzing logs i'm finding visitors click same button multiple times (sometimes 10 times) within minute or two, totally skews results.

i trying create query count each visitor (by ip) once within 5 minute timeframe. have come following, gives me total count, can't seem find right combination break down chunks of time. (datetime of type date)

select count(ip), ip, link, datetime  `clicks` group ip, link 

is there simple way accomplish this, or thinking incorrectly? suppose group day if necessary, break down more granularly if possible.

any pointers in right direction appreciated!

if want counts of ips per 5 minute interval today, try this:

select count(ip) ipcount,dt (     select     ip,(datetime - interval mod(unix_timestamp(datetime),300)) second dt     `clicks`     datetime >= (date(now()) + interval 0 second) ) group dt; 

the expression date(now()) + interval 0 second midnight today

mysql> select date(now()) + interval 0 second; +---------------------------------+ | date(now()) + interval 0 second | +---------------------------------+ | 2012-06-05 00:00:00             | +---------------------------------+ 1 row in set (0.00 sec)  mysql> 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -