Where clause with 80% true Condition in BigQuery?

Viewed 140

I have to put a query in BigQuery where we have 100 conditions( in where clause). I want, if any of 80+ conditions are true then it should fetch the data. Is that possible in Big Query?

1 Answers

Below is for BigQuery Standard SQL

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