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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-12-17 : 13:23:01
|
| Peter writes "I have a log table constructed as follows:id, eventtime, eventtype, userid, itemid, .....where id, userid and itemid are guid's, eventtime is a datetime field and eventtype is an integer.I need a query that can return the top 10 most frequent occuring itemid's that has eventtype=1I'm completely stuck on this, and would appreciate any help i can get :)RegardsPH" |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-12-17 : 13:29:11
|
| SELECT TOP 10 itemid, count(*)FROM yourtableWHERE eventtype = 1GROUP BY itemidORDER BY 2 DESCBrett8-) |
 |
|
|
|
|
|