Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 detecting spam

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2004-03-11 : 04:50:14

I have a mailbox feature on a website I am working on in which people are increasingly using to spam other members. Whats the best way for me to select all rows in a table where there are more than 5 rows of the same message?


Thanks again for any help

mike123

nr
SQLTeam MVY

12543 Posts

Posted - 2004-03-11 : 05:22:44
select t1.*
from tbl t1
join (select msg from tbl group by tbl having count(*) > 5) t2
on t1.msg = t2.msg


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Frank Kalis
Constraint Violating Yak Guru

413 Posts

Posted - 2004-03-11 : 05:27:23
[code]
SELECT
MsgSubject
FROM
mails_header
GROUP BY
MsgSubject
HAVING COUNT(*) > 5
[/code]
might be a starting point. In your case it should be more tricky as most spams have a random number or string in their subject line.

Maybe you can query your table for how many mails soneone has sent?

HTH


--Frank
http://www.insidesql.de
Go to Top of Page
   

- Advertisement -