我的数据库:
category (cat_id,cat_name)
topic (topic_id,cat_is)
comment(com_id,topic_is)
现在我想计算一个类别的总评论。
答案 0 :(得分:1)
select cat_id, count(1) cnt
from category
join topic on cat_is = cat_id
join comment on topic_is = topic_id
group by cat_id