28,406
社区成员
发帖
与我相关
我的任务
分享
, 借助中间表
select [id], count(id) as num into [#tempTB] from 留言表 group by [ID] order by num desc
select a.* from [项目表] a, [#tempTB] b where a.[id]=b.[id] order by b.num desc
drop table tempTB
select * from (select id, count(留言) as c from 留言表 group by id)b order by b.c desc