1
爲什麼我在sqlite下面的SQL語句中出現語法錯誤?表更新時出現SQL語法錯誤
錯誤寫着:
SQL Error: near "SET": syntax error
UPDATE nova
SET Nome = (select Nome from assessores where nova.ID = assessores.ID),
SET Morada = (select Morada from assessores where nova.ID = assessores.ID),
SET Email = (select Email from assessores where nova.ID = assessores.ID),
SET TelfCasa = (select TelfCasa from assessores where nova.ID = assessores.ID),
SET TelfEmprego = (select TelfEmprego from assessores where nova.ID = assessores.ID),
SET Telemovel = (select Telemovel from assessores where nova.ID = assessores.ID),
SET Fax = (select Fax from assessores where nova.ID = assessores.ID)
WHERE EXISTS (select * from assessores where nova.ID = assessores.ID);
如果我嘗試完全限定SET字段名,誤差變:
SQL Error: near ".": syntax error
DOH!謝謝約翰。 – 2009-10-24 18:56:33
你對'SET'的使用是正確的,但我不認爲SQLite支持多表'UPDATE'語法。你正在顯示MySQL語法。 – 2009-10-24 19:44:41
它支持它。這不是問題。自從我上次使用SQL並且在查看SQLite文檔(http://www.sqlite.org/lang_update.html)的語法時完全缺少了SET不是field = value循環的一部分的事實,這已經過去了一段時間。 – 2009-10-24 21:30:53