排序请问

排序请教!select * from 主题 where ID in (SELECT top 10 pidFROM dbo.用户记录 where 点击1 group by p

排序请教!
select * from 主题 where ID in (SELECT top 10 pid  FROM dbo.用户记录 where 点击=1 group by pid  order by COUNT(pid) desc)  

 有人知道怎样使外层和里层排序一致??现在就是外层获取不了COUNT(pid)