日期:2014-05-17  浏览次数:20470 次

论坛如何获取一周内的发帖量
论坛如何获取一周内的前10个用户的发帖量

------解决方案--------------------
SQL code
select count(*) as topiccount, first(userid) from topictable where date between 2012-03-01 and 2012-03-31 group by userid order by topiccount

------解决方案--------------------
select top 10 userid from table where timecreate between time1 and time2 group by id order by COUNT(0)desc
------解决方案--------------------
group by userid
------解决方案--------------------
select top 10 from table where datediff(week,endtime,getdate())=0

查询一周内的数据,可以动态给值