0
我有以下表格:Persons,Person_Categories和Persons_PersonCategories,它是n:m關係的鏈接表。在查詢中插入,更新,刪除語句
我也寫了下面的查詢,但插入語句無法正常工作。插入,更新和刪除是單獨的語句。該錯誤消息我得到的是
SELECT Persons_PersonCategories.PersonID, PrsCategory
FROM Person_Categories
INNER JOIN Persons_PersonCategories
ON Persons_PersonCategories.PrsCatID = Person_Categories.PrsCatID
INSERT INTO Persons_PersonCategories
VALUES (:PrsCategory)
UPDATE Persons_PersonCategories
SET Persons_PersonCategories.PrsCatID = :PrsCatID
WHERE Person_Categories.PrsCatID = :OLD PrsCatID
AND Persons.PersonID = :OLD PersonID
DELETE FROM Persons_PersonCategories
WHERE Person_Categories.PrsCatID = :PrsCatID
AND Persons.PersonID = :PersonID;
任何幫助將不勝感激「列數不爲1的行匹配值計數」, 攢
你可能在你的INSERT語句中,前指定列列表:插入到表(COL1,COL2)值(:VAL1,:VAL2) – 2012-01-18 17:36:47
國家請你的表格模式。 – 2012-01-18 17:37:57
這看起來不像一個查詢。相反,它看起來像四個單獨的陳述。 – dasblinkenlight 2012-01-18 17:38:52