Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google bigquery BigQuery-REGEXP_包含删除空值_Google Bigquery - Fatal编程技术网

Google bigquery BigQuery-REGEXP_包含删除空值

Google bigquery BigQuery-REGEXP_包含删除空值,google-bigquery,Google Bigquery,我试图排除网站中包含xyz和123的行。但是,该查询也排除了具有空值的行。因此,它返回的不是4行,而是3行,即数字6被排除在外 有人能说出问题的原因和正确的解决方案吗 我不想使用NOT IN,因为我的排除条件是一个很长的列表,所以我认为REGEXP_CONTAINS是唯一的出路。如果有任何其他字符串函数,请建议 使用的查询: SELECT number,source,detail,website FROM `tablename` where not REGEXP_CONTAINS(website

我试图排除网站中包含xyz和123的行。但是,该查询也排除了具有空值的行。因此,它返回的不是4行,而是3行,即数字6被排除在外

有人能说出问题的原因和正确的解决方案吗

我不想使用NOT IN,因为我的排除条件是一个很长的列表,所以我认为REGEXP_CONTAINS是唯一的出路。如果有任何其他字符串函数,请建议

使用的查询:

SELECT number,source,detail,website FROM `tablename` where not REGEXP_CONTAINS(website, r'xyz') and not REGEXP_CONTAINS(website, r'123')

它应该排除
NULL


如果希望
NULL
行,则需要添加
逻辑
列为NULL

应该排除
NULL


如果希望
NULL
行,则需要添加
逻辑
列为NULL

当应用于
NULL
值时,
BigQuery
regexp\u包含
函数,返回
NULL
。在您的情况下,当对
NULL
值应用
操作时,该值不会更改。尽管如此,
WHERE
子句将
NULL
值视为false

如果要保留假值,应执行以下操作:

SELECT number,source,detail,website FROM `tablename` where (not REGEXP_CONTAINS(website, r'xyz') and not REGEXP_CONTAINS(website, r'123')) or website is NULL

我希望当应用于
NULL
值返回
NULL
时,
BigQuery
regexp\u包含
函数,这会有所帮助。在您的情况下,当对
NULL
值应用
操作时,该值不会更改。尽管如此,
WHERE
子句将
NULL
值视为false

如果要保留假值,应执行以下操作:

SELECT number,source,detail,website FROM `tablename` where (not REGEXP_CONTAINS(website, r'xyz') and not REGEXP_CONTAINS(website, r'123')) or website is NULL
我希望有帮助