我正在尝试使用具有多行where子句的update查询。它包含倒逗号、空格和换行符。反斜杠适用于反逗号,但不能处理子句中的空格和空行。因为它是更新where子句,所以我无法更改子句的结构,否则它将与现有值不匹配。
UPDATE dataset.datatable
SET project = "something"
WHERE identifier="The $1.90M adajdshsas ahsdsjahd adsad add adddadcxv ksdf sdfsd sdfsff.
adjajasd by ahsdhasf kkjfdsg \"kasf the new uenf will\" ensure #maidsbd and surrounding communities will have greater access to #madaudafvys support and sajdahdj locally.
The new centre was funded through the asdashdgad jsfjfsfuu kasahfa(hsf).
Read more: asdgsa./asdga
#hasdad #sadauyd
asdahda, asdad\'s dshag, minadahdh"我尝试使用like,但是,列中有太多类似的值。
UPDATE dataset.datatable
SET project = "something"
WHERE identifier LIKE "%The $1.90M%" AND identifier LIKE "%\"kasf the new uenf will\"%"是否存在处理这种情况的方法,还是必须通过删除所有非字母数字字符来修改表中的列?
发布于 2022-08-31 04:55:09
下面的示例演示了该方法
CREATE TEMP TABLE your_table as (
SELECT 1 id, "abc12345678" project, r"""The $1.90M adajdshsas ahsdsjahd adsad add adddadcxv ksdf sdfsd sdfsff.
adjajasd by ahsdhasf kkjfdsg \"kasf the new uenf will\" ensure #maidsbd and surrounding communities will have greater access to #madaudafvys support and sajdahdj locally.
The new centre was funded through the asdashdgad jsfjfsfuu kasahfa(hsf).
Read more: asdgsa./asdga
#hasdad #sadauyd
asdahda, asdad\'s dshag, minadahdh""" identifier UNION ALL
SELECT 2, "xyz876543", "qwertyu"
);
UPDATE your_table
SET project = "something"
WHERE identifier = r"""The $1.90M adajdshsas ahsdsjahd adsad add adddadcxv ksdf sdfsd sdfsff.
adjajasd by ahsdhasf kkjfdsg \"kasf the new uenf will\" ensure #maidsbd and surrounding communities will have greater access to #madaudafvys support and sajdahdj locally.
The new centre was funded through the asdashdgad jsfjfsfuu kasahfa(hsf).
Read more: asdgsa./asdga
#hasdad #sadauyd
asdahda, asdad\'s dshag, minadahdh""" ;
select * from your_table; 在上面的示例中-更新前的your_table是

在更新之后

https://stackoverflow.com/questions/73549691
复制相似问题