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.
| 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 helpmike123 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-03-11 : 05:22:44
|
| select t1.*from tbl t1join (select msg from tbl group by tbl having count(*) > 5) t2on 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. |
 |
|
|
Frank Kalis
Constraint Violating Yak Guru
413 Posts |
Posted - 2004-03-11 : 05:27:23
|
| [code]SELECT MsgSubjectFROM mails_headerGROUP BY MsgSubjectHAVING 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--Frankhttp://www.insidesql.de |
 |
|
|
|
|
|