MySQLで次のことを行うにはどうすればよいですか?
UPDATE PartTbl SET aFlag = 0
WHERE PartId = (SELECT PartId FROM CategoryTbl WHERE cat = 100)
MySQLで次のことを行うにはどうすればよいですか?
UPDATE PartTbl SET aFlag = 0
WHERE PartId = (SELECT PartId FROM CategoryTbl WHERE cat = 100)
UPDATE PartTbl SET aFlag = 0
WHERE PartId IN (SELECT PartId FROM CategoryTbl WHERE cat = 100)
"IN"
WHERE 句で代わりに演算子を使用"="
するか、次のコードを使用します。
UPDATE A
SET aFlag = 0
From PartTbl As A
Inner Join
CategoryTbl As B
On A.PartId = B.PartId
WHERE B.cat = 100
UPDATE PartTbl pt SET aFlag = 0
WHERE exists (
SELECT PartId FROM CategoryTbl ct
WHERE cat = 100 and pt.partId = ct.partId)