我有桌子:
RUBRIC: RubricID, RubricName
AUTOR: AutorID, FirstName, LastName
BOOK: BookID, BookName, book_photo
BOOKAUTOR: BookID, AutorID
BOOKRUBRIC: BookID, RubricID
而且我不知道如何选择写这本书的一本书的所有书籍。 我可以写这样的
select distinct book.BookName, autor.LastName
from autor, book
where autor.LastName = book name;
但这是错误的。我知道我需要使用JOIN,但我不明白怎么做?帮助
答案 0 :(得分:0)
尝试将您的查询更改为:
SELECT book.BookName, autor.LastName
FROM book
LEFT JOIN bookautor ON bookautor.BookID = book.BookID
LEFT JOIN autor ON bookautor.AutorID = autor.AutorID
WHERE autor.LastName = ''