I would like to have a simple query that I can run against the database in order to return abnoralities to the threshold of time that users post on our forum. If I have the 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 would like to set a threshold, for example, to say that if 3 messages from the same user fall within 1 minute, the poster can send out forums. In turn, I would like to return a custom "Spammer" in the request with the number of messages made during the allotted time.
In the above example, Spammer sent 4 messages over a period of 1 minute, so the query result might look like this:
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 the format of the returned data are welcome. The format does not matter to me, as it is correct to identify forum violators.
sql-server tsql
George Johnston
source share