mysql一条sql完成统计帖子下面有多少条回复
SELECT a.*,(select count(*) from theme as b where b.parent_id=a.id) as tiezi_count FROM `theme` as a WHERE a.id>0
在需要取的字段中,写mysql的子查询进行统计。