My algorithm is for a hit count, I am tring to not count for the same person twice if that person came to the site twice in a time internval (For example if he comes twice in 5 minutes, I want to count it as 1 for this person)
Here how my database looks like
UserIp UserId Date of user came
127.0.0.1 new.user.akb 26.03.2010 10:15:44
127.0.0.1 new.user.akb 26.03.2010 10:16:44
127.0.0.1 new.user.akb 26.03.2010 10:17:44
127.0.0.1 new.user.akb 26.03.2010 10:18:44
127.0.0.1 new.user.akb 26.03.2010 10:19:44
127.0.0.1 new.user.akb 26.03.2010 10:20:44
127.0.0.1 new.user.akb 26.03.2010 10:21:44
127.0.0.1 new.user.akb 26.03.2010 10:22:44
127.0.0.1 new.user.akb 26.03.2010 10:23:44
What I need to do is get number of distinct UserIPs from the table above that occured within a time interval. For example if I set the time interval for 5 minutes, and let say that is starts at
26.03.2010 10:15:44
Then I will get 2 as the results, since 1 distinct value between 10:15 to 10:20 and , 1 distinct value from 10:20 to 10:23,
For example if my interval is 3 minutes than the return result will be 3
Thanks.