Google Big Query 确切位置

Scr*_*ies 2 google-bigquery

抱歉,我对 Google Big Query 的经验很少。我想给出一个“WHERE”子句给出准确输出的查询。

现在我的陈述看起来像:

Select values
where values CONTAIN '8'
Run Code Online (Sandbox Code Playgroud)

这给了我包含的值

 8
 12,800
 12,8,20
 5,7,8
 100,8000
Run Code Online (Sandbox Code Playgroud)

我怎样才能改变查询只给我

8
12,8,20
5,7,8
Run Code Online (Sandbox Code Playgroud)

Jav*_*rez 5

您不需要完全匹配,而是需要部分匹配,其中子字符串为 8(可选用逗号)。你可以尝试类似的东西

从表中选择值,其中 REGEXP_MATCH(values, r'(^8$)|(^8,)|(,8,)|(,8$)')

与值 '8' 匹配,或以中间的 '8,' 或 ',8' 开头或以 ',8' 结尾