I have to 2 tables in my database.
First one is author contains (int author_id, text name_of_author).
Second one is book contains (int book_id, int author_id, text name_of_book, text genre).
They related by author_id;
I'm trying to get a query, that will give me list of genre without duplicates, and number of authors who have written in this genre.
It should look something like this:
GENRE NAME_OF_AUTHERS
novel 12
poems 4
fantasy 20
... ..
etc..
I try to do something like this:
SELECT DISTINCT A.GENRE, COUNT(B.NAME_OF_AUTHOR) FROM BOOK AS A
LEFT JOIN AUTHOR AS B
ON A.AUTHOR_ID = B.AUTHOR.ID;
But it gives me wrong result.