[英]Replace a string value in a column by values from same column in another table
[英]How to replace all string values from a column to another value?
我想替換列中的所有值,例如,將lane
列中的所有值替換為“所有車道”值。 我嘗試使用 REPLACE function: REPLACE(lane, '%', 'All lanes')
但它不起作用。 有什么想法嗎? 提前致謝!
車道 |
---|
WA-OR |
德克薩斯-紐約 |
馬-新澤西 |
預期 output:
車道 |
---|
所有車道 |
所有車道 |
所有車道 |
只需使用update
:
update t
set lane = 'All lanes';
請注意,這會永久影響所有行。 如果您只想查詢結果:
select 'All lanes' as lane
from t;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.