Home > Mobile >  How to include more than one value in IN operator in Big Query
How to include more than one value in IN operator in Big Query

Time:01-22

I have the following query that is working fine in Big Query:

SELECT
date,
nombre,
i.identifier,
i.hour
FROM
  `adsmovil-produccion.analisis_alejandro.100_temp_pers` t, unnest(identifier_s) i
where 2 in unnest(i.hour)

However, I need to include more integers in the search value of the IN operator. Something like this:

...where (2 or 5 or 6) in unnest...

CodePudding user response:

Consider below example - hope yo will be able to adopt it to your specific use-case

select date, nombre, i.identifier, i.hour 
from `adsmovil-produccion.analisis_alejandro.100_temp_pers` t, 
unnest(identifier_s) i 
where exists (
  select 1
  from unnest(i.hour) x
  join unnest([2, 5, 6]) x
  using(x)
)
  •  Tags:  
  • Related