我有三个 mysql 表tblOne
,tblTwo
并且tblThree
SELECT tblOne.bookID AS bookID,
tblOne.title AS title,
tblOne.author AS author,
tblOne.blurb AS blurb,
tblOne.isbn AS isbn,
tblOne.coverImage As coverImage,
CONCAT_WS(" ", tblThree.firstName, tblThree.lastName) AS fullName,
tblTwo.rating,
tblTwo.reviewText AS review,
CONCAT_WS(" ", tblTwo.reviewDate, tblTwo.reviewTime) AS reviewDate
FROM tblTwo
INNER JOIN tblOne
ON tblTwo.bookID = tblOne.bookID
INNER JOIN tblThree
ON tblTwo.userID = tblThree.userID
WHERE tblTwo.bookID = 1000102;
输出填充了一个 XML 文件,对于这本书,有两个评论,因此,等的数据title
被author
提取了两次。我该如何克服这个问题,因为当我尝试从JavaScript
查询中访问标签时,它会失败,因为它说它是未定义的。我认为这是由于有多个结果。
上面的 SQL 确实有效,我的 PHP 是错误的,但是......
即使没有,我该如何退回图书详细信息review
?目前,只有经过审核的书籍才会返回其详细信息。