简体   繁体   中英

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. I tried to use REPLACE function: REPLACE(lane, '%', 'All lanes') but it does not work that way though. Any thoughts? Thanks in advance!

lane
WA-OR
TX-NY
MA-NJ

Expected output:

lane
All lanes
All lanes
All lanes

Just use 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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM