一个文章表,一个评论表,通过文章的ID关联,现在要查出文章表中的一条数据和评论表中关于这篇文章的评论的个数,求帮忙 谢谢了。
7条回答 默认 最新
惊人的 2015-08-18 08:20关注select w.*,(select count(*) from 评论表 p where p.id=w.id ) as cnt from 文章表 w where w.id=" "看明白不?
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
select w.*,(select count(*) from 评论表 p where p.id=w.id ) as cnt from 文章表 w where w.id=" "看明白不?