sql server - Help identifying forum spammers via a SQL query? -


i have simple query can run against database return abnoralities in time threshold users post our forum. if have following database structure:

threadid | userid | postauthor | postdate | 1          1000     spammer      2010-11-14 02:52:50.093 2          1000     spammer      2010-11-14 02:53:06.893 3          1000     spammer      2010-11-14 02:53:22.130 4          1000     spammer      2010-11-14 02:53:37.073 5          2000     realuser     2010-11-14 02:53:52.383 6          1000     spammer      2010-11-14 02:54:07.430  

i set threshold instance, if 3 posts, same user, fall within time period of 1 minute, poster may spamming forums. in turn, return user 'spammer' in query, number of posts made within allotted time.

in above example, spammer posted 4 messages within time period of 1 minute, result of query may following:

userid | postauthor | postcount | datestart               | dateend 1000     spammer      4           2010-11-14 02:52:50.093   2010-11-14 02:53:37.073 

any suggestions in format of returned data our welcome. format doesn't matter me as correctly identifying forum abusers accurately.

doesn't have wanted in output, it's start:

(reword: give me posts 2 or more other posts exist after it, within 1 minute)

select    spammer = postauthor,   numberofposts = (select count(*)                     posts allposts                     allposts.userid = posts.userid) posts 2 <= (select count(*)             posts otherposts             otherposts.userid = posts.userid               , otherposts.postdate > posts.postdate               , otherposts.postdate < dateadd(minute, 1, posts.postdate)) 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -