[英]REGEX_MATCH pattern works everywhere but Google Data Studio
[英]Convert SQL to REGEX to Data Studio
我剛開始使用 Google Data Studio。 我正在嘗試在某些數據上做一個案例,但我只有 SQL。
以下是我正在使用的示例。 我知道這不是創建此示例的最佳方式。 我通常使用 work 進行查詢,所以這些示例對我來說是新的。
創建表 #botdata(botstatus varchar(255))
插入#botdata (botstatus) 值 ('0|3900000:3900037:3900999:BOT-ANOMALY-HEADER|undefined|false')
插入 #botdata (botstatus) 值 ('1|3900037|undefined|false')
插入#botdata (botstatus) 值 ('0|3900005:3900024|undefined|')
我正在使用查詢將以上內容分組到 SQL 中,但我需要在 Google Data Studio 中格式化相同的查詢,但我不確定如何
select case when botstatus like '1|%' OR (botstatus like '0|%' and botstatus like '%BOT-%') then 'BOT'
when botstatus like '0|%' then 'Regular Visit' else 'Regular Visit NO BOT STATUS' end as updatedbotstatus, botstatus
from #botdata
自“|”以來出現問題和'-'是數據工作室中的特殊章程。
試過這個但沒有得到我需要的結果。
CASE
WHEN REGEXP_MATCH( Bot Status(11) ,'0\\|*') and REGEXP_MATCH(Bot Status(11),'*BOT\\-*') then 'Bot'
ELSE 'Other'
END
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.