[英]How to replace all string values from a column to another value?
I want to replace all values from a column, like for example, to replace all values from lane
column to 'All lanes' value.我想替换列中的所有值,例如,将
lane
列中的所有值替换为“所有车道”值。 I tried to use REPLACE function: REPLACE(lane, '%', 'All lanes')
but it does not work that way though.我尝试使用 REPLACE function:
REPLACE(lane, '%', 'All lanes')
但它不起作用。 Any thoughts?有什么想法吗? Thanks in advance!
提前致谢!
lane![]() |
---|
WA-OR ![]() |
TX-NY![]() |
MA-NJ![]() |
Expected output:预期 output:
lane![]() |
---|
All lanes![]() |
All lanes![]() |
All lanes![]() |
Just use update
:只需使用
update
:
update t
set lane = 'All lanes';
Note this permanently affects all rows.请注意,这会永久影响所有行。 If you just want the result in a query:
如果您只想查询结果:
select 'All lanes' as lane
from t;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.