mysql - ISQL For each author, list their number, last name, and number of books they written -


select a.author_num, a.author_last, count(w.book_code) book.book b, book.author a, book.wrote w (b.book_code=w.book_code , w.author_num=a.author_num) order a.author_last desc; 

i have 3 tables; book, author, , wrote. need find how many books author has written. need sub-query?

you can use group by

select a.author_num, a.author_last, count(w.book_code) book.book b, book.author a, book.wrote w (b.book_code=w.book_code , w.author_num=a.author_num) group a.author_num, a.author_last order a.author_last desc; 

although feel column names aren't quite correct


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -