我尝试将一个大量的UPDATE运行到一个表,改变了两个具有多个值的列。
UPDATE ofertanti SET
Lat = Case OfertantId
WHEN 1 THEN '44.4498109'
WHEN 2 THEN '44.461097'
WHEN 3 THEN '44.424998'
WHEN 4 THEN '44.467109'
WHEN 166 THEN '46.360884'
WHEN 5 THEN '44.452551'
WHEN 6 THEN '44.4535468'
WHEN 7 THEN '44.437809'
WHEN 8 THEN '44.442972'
WHEN 10 THEN '44.4099361'
END,
Long = Case OfertantId
WHEN 1 THEN '26.099139'
WHEN 2 THEN '26.085677'
WHEN 3 THEN '26.075464'
WHEN 4 THEN '26.087947'
WHEN 166 THEN ' 25.803683'
WHEN 5 THEN '26.078921'
WHEN 6 THEN '26.0887823'
WHEN 7 THEN '26.1158709'
WHEN 8 THEN '26.131282'
WHEN 10 THEN '26.0705676'
END
它抛出了这个错误:
Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Long = Case OfertantId WHEN 1 THEN '26.099139' WHEN 2 THEN '26.085677' WHEN 3' at line 14
知道我做错了什么吗?我正在使用MySQL。
答案 0 :(得分:2)
显然,问题是由Long
引起的,它是SQL中的保留关键字,我将它用于经度。