使用通配符更新多行
Update multiple rows with wildcards
我可以在 Postgresql 中做类似下面的事情吗?显然第二行的语法是错误的。
UPDATE "MySchema"."MyTable"
SET email = '%@@%'
WHERE email LIKE '%@%'
您不能像这样使用通配符,但您可以使用 regular expressions 进行几乎任何您想要的字符串操作。加倍电子邮件地址中的 @
会像这样:
UPDATE "MySchema"."MyTable"
SET email = regexp_replace(email, '@', '@@')
WHERE email LIKE '%@%';
我可以在 Postgresql 中做类似下面的事情吗?显然第二行的语法是错误的。
UPDATE "MySchema"."MyTable"
SET email = '%@@%'
WHERE email LIKE '%@%'
您不能像这样使用通配符,但您可以使用 regular expressions 进行几乎任何您想要的字符串操作。加倍电子邮件地址中的 @
会像这样:
UPDATE "MySchema"."MyTable"
SET email = regexp_replace(email, '@', '@@')
WHERE email LIKE '%@%';