SQL SELECT with time range

Posted by nLL on Stack Overflow See other posts from Stack Overflow or by nLL
Published on 2010-05-10T08:15:10Z Indexed on 2010/05/10 8:44 UTC
Read the original article Hit count: 226

Filed under:
|
|

Hi, I have below click_log table logging hits for some urls

site    ip    ua    direction   hit_time
-----------------------------------------------------
 1      127.0.0.1      1         20010/01/01 00:00:00

 2      127.0.0.1      1         20010/01/01 00:01:00

 3      127.0.0.1      0         20010/01/01 00:10:00

....    .........

I want to select incoming hits (direction:1) and group by sites that are:

  • from same ip and browser
  • logged within 10 minutes of each other
  • occured more than 4 times in 10 minutes.

I'm not sure if above was clear enough. English is not my first language. Let me try to explain with an example.

If site 1 gets 5 hits from same ip and browser with in 10 minutes after getting first unique hit from that ip and browser i want it to be included in the selection.

Basically I am trying to find abusers.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server