一个通过文章点击数,简单实现周、月、年排行 的方法:
"select top 10 * from [table] where Datediff(d,[Time],getdate())<7 order by hits desc ";
"select top 10 * from [table] where Datediff(d,[Time],getdate())<30 order by hits desc ";
"select top 10 * from [table] where Datediff(d,[Time],getdate())<365 order by hits desc ";
"select top 10 * from [table] where Datediff(d,[Time],getdate())<30 order by hits desc ";
"select top 10 * from [table] where Datediff(d,[Time],getdate())<365 order by hits desc ";