select c.id
,c.name
,count(*) as num_books
from categories c
join books_categories bc on(bc.category_id = c.id)
group
by c.id
,c.name;
Run Code Online (Sandbox Code Playgroud)
LEFT JOIN如果您还想要没有书籍的类别,请使用.
| 归档时间: |
|
| 查看次数: |
75 次 |
| 最近记录: |