Say I have a database of publishers, who employ authors, who write books.
Or to phrase it another way, each book, is written by an author, who works for a publisher.
authors: id, publisher_id
books: id, author_id
I ended up with something similar, but different to the three answers given:
SELECT publishers.*, COUNT(authors.publisher_id) AS 'author_count', COUNT(books.author_id) AS 'book_count' FROM publishers LEFT JOIN authors ON (authors.publisher_id = publishers.id) LEFT JOIN books ON (books.author_id = authors.id) GROUP BY publishers.id;