排序后结果为: 本周点击量最高的帖子为: 排名 帖子ID 1 1 -- 点击过5次 2 3 -- 点击过3次 3 2 -- 点击过2次select topicId from table_list where max (select count(topicId) from table_list) and group by topicId SQL code:
SELECT id,'点击过'+convert(varchar(10),count(clickTime))+'次' from [dbo].[TABLE1] where datepart(wk,clickTime)=datepart(wk,getdate()) group by id order by count(clickTime) desc