以下代码适用于MS Access,但我无法使其与SQL Server 2008一起使用。
UPDATE Borrow INNER JOIN BorrowDetails
ON Borrow.BorrowID = BorrowDetails.BorrowID
SET BorrowDetails.Returned = True
WHERE BookID = 1 AND MemberID = 1
请知道。
答案 0 :(得分:2)
UPDATE BorrowDetails
SET BorrowDetails.Returned = True
FROM BorrowDetails
INNER JOIN Borrow ON Borrow.BorrowID = BorrowDetails.BorrowID
WHERE BookID = 1 AND MemberID = 1
答案 1 :(得分:1)
请改为尝试:
UPDATE bd
SET bd.Returned = 1
FROM BorrowDetails bd
INNER JOIN Borrow b ON bd.BorrowID = b.BorrowID
WHERE b.BookID = 1 AND b.MemberID = 1
答案 2 :(得分:0)
UPDATE x
SET x.Returned = True
FROM (
SELECT Returned
FROM Borrow INNER JOIN BorrowDetails ON Borrow.BorrowID = BorrowDetails.BorrowID
WHERE BookID = 1 AND MemberID = 1
) x