簡體   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