1

以下のコードは 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

任意のアイデアをお願いします。

4

3 に答える 3

2
UPDATE BorrowDetails
SET BorrowDetails.Returned = True 
FROM BorrowDetails
INNER JOIN Borrow ON Borrow.BorrowID = BorrowDetails.BorrowID 
WHERE BookID = 1 AND MemberID = 1
于 2012-10-30T07:41:06.433 に答える
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
于 2012-10-30T07:39:33.787 に答える
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 
于 2012-10-30T13:58:11.790 に答える