SELECT table3.CategoryID, table3.CategoryName, count(table1.MovieID) AS total
FROM table3 JOIN table2 ON table3.CategoryID = table2.CategoryID JOIN table1 ON table2.MovieID = table1.MovieID
GROUP BY table3.CategoryID
SELECT * FROM table1 LEFT JOIN table2 ON(table1.MovieID = table2.MovieID) LEFT JOIN table3 (table2.categaryID = table3.categaryID) GROUP BY table.MovieID
SELECT category.CategoryID, category.CategoryName, count(rentdetail.MovieID) AS total
FROM category JOIN member ON category.CategoryID = member.CategoryID JOIN rentdetail ON member.MovieID = rentdetail.MovieID GROUP BY category.CategoryID