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 |
|
jon.a.smith
Starting Member
1 Post |
Posted - 2008-08-13 : 13:12:34
|
| table:datetermcounti have a table specified above that i increment the count on each time a ui field is selected. this count is good for a day. i'd like to be able to query the table for a date range and find the top X terms based on the count summary for the date range (not single day). any ideas?thanks. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-13 : 13:15:47
|
| [code]SELECT TOP X termFROM(SELECT term,sum(count) as total FROM table WHERE date BETWEEN @StartDate AND @EndDate GROUP BY term)tORDER BY total DESC[/code]@StartDate and @EndDate variable values represent your daterange. |
 |
|
|
|
|
|