繁体   English   中英

如何处理更新查询的 where 子句中的多行 (BigQuery)

[英]How to handle multiple lines in a where clause for an update query (BigQuery)

我正在尝试使用具有多行 where 子句的更新查询。 它包含引号、空格和换行符。 反斜杠适用于反逗号,但不能处理子句中的空格和空行。 由于它是一个更新 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\"%"

有没有办法处理这种情况,或者我是否必须通过删除所有非字母数字字符来修改表中的列?

下面的示例演示了该方法

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更新前是

在此处输入图像描述

更新后是

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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