2

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

enter image description here

3
  • I believe you missed a sentence. Why do you need a subquery here? Commented Mar 17, 2017 at 18:38
  • Please don't insert screenshots of code or queries, insert them as text into the question and format as code (4 spaces indent) Commented Mar 17, 2017 at 18:39
  • Please read meta.stackoverflow.com/questions/285551/… and the accepted answer Commented Mar 17, 2017 at 18:51

1 Answer 1

1
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;      
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.