------解决方案-------------------- select * from 表A where id=(select top 1 articleid from 表B group by articleid order by count(*) desc) ------解决方案--------------------
写错了,第二个where条件应该是<30 ------解决方案-------------------- select top 5 A.*,B.total from 表A as a left join (select articleid,Count(articleID) as total from 表B group by articleid) as b on a=id.b.articleid order by B.total desc ------解决方案--------------------
等号位置是不是错啦,
on a.id=b.articleid
还有时间限制
where datediff('d',a.addtime,now())<30