我有2个表数据:
db_category:
+ idcategory
+名称
db_book:
+ idbook
+名称
+ idcategory
现在我想按类别显示书籍,解释:
书1:2档
书2:2档
请帮帮我,谢谢
答案 0 :(得分:0)
SELECT a.idcategory, COUNT(*) as count FROM
FROM db_category a, db_book b
WHERE a.idcategory = b.idcategory'
GROUP BY a.idcategory;