gpt4 book ai didi

MySQL 错误 : #1242 - Subquery returns more than 1 row

转载 作者:行者123 更新时间:2023-11-29 03:26:02 26 4
gpt4 key购买 nike

SELECT BookId, Duedate, (SELECT Title FROM Book_Information WHERE BookId = BookId)
FROM Transaction_Information WHERE DueDate <= CURDATE() AND ReturnedDate IS NULL

book id是transaction_information中的外键。我想将图书信息表中的Title字段添加到交易信息表中

最佳答案

由于Transaction_Information.BookId外键,它引用Book_Information 表中的相应行,因此一个简单的INNER JOIN 会完成这项工作。

这是查询:

SELECT
TF.BookId,
TF.Duedate,
BF.Title
FROM Transaction_Information TF
INNER JOIN Book_Information BF
ON TF.BookId = BF.BookId
WHERE TF.DueDate <= CURDATE() AND TF.ReturnedDate IS NULL;

关于MySQL 错误 : #1242 - Subquery returns more than 1 row,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36231715/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com