gpt4 book ai didi

mysql - 如何替换多列中存在的值?

转载 作者:行者123 更新时间:2023-11-29 04:40:30 24 4
gpt4 key购买 nike

我有一个数据库表 foo,我想用空字符串替换特定列中的 null 值。为了删除特定列 x 中存在的空值,我会喜欢

update foo set x = '' where x is null;

有没有我想要的,

update foo set x,y,z = '' where x,y,z is null; 

最佳答案

您可以:

set 
x = case when x is null then '' else x,
y = case when y is null then '' else y,
z = case when z is null then '' else z
...

关于mysql - 如何替换多列中存在的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30074797/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com