我想将“,”字符更改为“.”在我的一个专栏中。我可以制作替换语法,但它只是一个 View 。我想更新所有记录!
select cast(replace(egysegar,',','.')as decimal (10,3)) from temporary
我会尝试下一个更新
UPDATE temporary set egysegar = replace(egysegar,',','.') where egysegar is not null
但在我收到错误后:
you are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Queries and reconnect.
最佳答案
很可能您正在使用 MySQL Workbench,并且实际上必须禁用安全模式或在 WHERE
子句中添加一个键列,正如消息中所述。
或者您可以在更新查询之前运行 SET SQL_SAFE_UPDATES=0;
。
关于mysql - 如何使用replace来更新列项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19558886/