首页 > 解决方案 > BigQuery 中条件为 80% 的 Where 子句?

问题描述

我必须在 BigQuery 中查询 100 个条件(在 where 子句中)。我想,如果 80 多个条件中的任何一个为真,那么它应该获取数据。在 Big Query 中可能吗?

标签: google-bigquerypybigquery

解决方案


以下是 BigQuery 标准 SQL

select *
from `project.dataset.table`
where (
  select countif(condition)
  from unnest([
    condition1,
    condition2,
    condition3,
    . . .
    condition99,
    condition100
  ]) condition
) >= 80

推荐阅读