Reputation: 9066
i have the following relational database tables
to get the author name of a certain book i made the following query
SELECT authors.name
FROM authors
INNER JOIN book_author ON authors.id=book_author.author_id
INNER JOIN books
ON books.id=book_author.book_id WHERE books.id=1;
but it is giving me the error in the title .How i can fix that ?
Upvotes: 0
Views: 55
Reputation: 328
Name is not a field in the table "authors". Select authors.author_name and it will run.
SELECT authors.author_name
FROM authors
INNER JOIN book_author ON authors.id=book_author.author_id
WHERE book_author.book_id=1;
Upvotes: 1