Reputation: 47
How could I write an SQL that will display authors and a total number of their publications with a sub query included in my SELECT STATEMENT but this is what I have
Upvotes: 2
Views: 45
Reputation: 13524
SELECT a.auth_name,COUNT( p.pub_title ) AS count_of_publications
FROM Author a
LEFT JOIN
Wrote w
ON a.auth_id = w.auth_id
LEFT JOIN
Publication p
ON w.pub_id = p.pub_id
GROUP BY a.auth_name;
Upvotes: 1