34,838
社区成员




select top 18 [user],isnull(count(zz),0) as num
from news right join (select * from admin where len(username)>0 and user <>'admin') t on news.zz=t.user
group by zz order
by count(zz) DESC
select
top 18 *
from
(select
user,0 as num
from
admin
where
len(username)>0 and user <>'admin'
and
user not in(select distinct zz from news)
union all
select
zz,count(zz) as num
from
news
where
sh=1 and zz in (select user from admin where len(username)>0 and user <>'admin') group by zz) as t
order by
t.num desc
select top 18 t.user ,count(zz) as num
from news right join (select * from admin where len(username)>0 and user <>'admin') t on news.zz=t.user
group by zz order by count(zz) DESC
试试