Welcome Guest, Not a member yet? Register   Sign In
How to count the number of 02 tables
#1

Hi every body ?
I have 2 table data:
db_category: 

+idcate
+name
db_book:
+ idbook
+ name
+ idcate

Now I want to count the number by category. 

Example: 
Book 1: 2 file
Book 2: 5 file

Please help me, thanks Big Grin
Reply
#2

This makes no sense at all. Huh

example
Code:
SELECT
    category.name,
    count(book.id)
FROM
    category
INNER JOIN
    book
ON category.id = book.id
GROUP BY category.id

cat_a 12
cat_b 10
Reply




Theme © iAndrew 2016 - Forum software by © MyBB