There is 3 tables.
Book. ID / Title
Author. ID / Name
Book_Author. Book_ID / Author_ID
The goal is to get all titles of books written by specific Author. We know the name of Author. I've tried an approach with join but it takes two steps to reach result anyhow I try.
for example:
select book_author.book_id, book_author.author_id
from book_author
inner join author on book_author.author_id = author.id
where name = 'author1';
select book.title
from book
inner join author_to_book on book.id = book_author.book_id
where author_id = 3;
Have tried to merge the methods but with no success so far. Any suggestions?