仅当列值不包含任何特定前缀时才连接
concat only if column value does not contain any specific prefix
如果列的值为 123,OI:909, 456,OI:789
,我想将前缀添加到列的数据中
然后更新为 OI:123,OI:909, OI:456, OI:789
我尝试关注 SQL
select col_1(case when col_1 NOT LIKE '%OI:%' then concat("OI:",col_1) end) from table_1;
你可以试试这个语法:
select
case when col_1 NOT LIKE '%OI:%'
then concat("OI:",col_1)
ELSE col_1
end col1
from table_1;
如果列的值为 123,OI:909, 456,OI:789
,我想将前缀添加到列的数据中
然后更新为 OI:123,OI:909, OI:456, OI:789
我尝试关注 SQL
select col_1(case when col_1 NOT LIKE '%OI:%' then concat("OI:",col_1) end) from table_1;
你可以试试这个语法:
select
case when col_1 NOT LIKE '%OI:%'
then concat("OI:",col_1)
ELSE col_1
end col1
from table_1;