27,579
社区成员
发帖
与我相关
我的任务
分享
SELECT A.*,B.replys FROM Info A LEFT JOIN
(SELECT InfoId,COUNT(*)replys FROM Comment GROUP BY InfoId)B
ON A.InfoId=B.InfoId
select
a.infoid,
a.title,
isnull(b.cnt,0) as replys
from
info a
left join
(select infoid,count(1) as cnt from comment group by infoid) b
on
a.infoid=b.infoid