SELECT Book_Title, Publisher_Name, Book_Type, Author_Last, Author_First
FROM Book, Author, Publisher, Wrote
WHERE Author.Author_Num=Wrote.Author_Num
AND Wrote.Book_Code=Book.Book_Code
AND Book.Publisher_Code=Publisher.Publisher_Code
GROUP BY Wrote.Book_Code, Book_Title, Book_Type, Publisher_Name, Author_Last, Author_First
HAVING COUNT (Wrote.Book_Code)=2;
目标:列出包含两位作者的每本书的标题,出版商名称,类型和作者姓名。
当我运行此查询时,我得到空行。有人帮忙为什么会这样吗?
答案 0 :(得分:0)
SELECT Book_Title, Publisher_Name, Book_Type, Author_Last, Author_First
FROM Book, Author, Publisher, Wrote
WHERE Author.Author_Num=Wrote.Author_Num
AND Wrote.Book_Code=Book.Book_Code
AND Book.Publisher_Code=Publisher.Publisher_Code
GROUP BY Wrote.Book_Code
HAVING COUNT (Wrote.Book_Code)=2;