This is a straight join, so just elaborating the GROUP BY should do the trick:
SELECT count(1), categories.name
FROM categories, books
WHERE categories.id = books.catid
GROUP BY categories.id, categories.name
You could do this with a subselect, but that would be overkill because there is only one join, and the categories table is very small.