Cansu
Cansu

Reputation: 167

How to implement “in” in BigQuery?

I'm trying to implement in command in SQL to BigQuery. When I write more than one IDs like the query below it returns no results. If I write only one ID words fine. Is there a function like IN in SQL?

    select hits.customDimensions.value, sum(totals.visits) Visits
    from [86958781.ga_sessions_20170130] 
    where hits.customDimensions.index = 13
    and hits.customDimensions.value contains "1719953,1329209"
    group by  hits.customDimensions.value 
    order by Visits desc 

Upvotes: 10

Views: 22322

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 172974

Is there a function like IN in SQL?

Sure, it is. You should use below syntax

AND hits.customDimensions.value IN ("1719953", "1329209")  

Upvotes: 18

Related Questions