google bigquery - SQL Count the distinct values that accomplish two condition for a single row -


hello i'm using google bigquerry , i'm trying table total number of distinct values accomplish 2 values row. let's explain it:

i have table like:

userid  |  platform 123     |  ios 123     |  android 123     |  other 124     |  android 124     |  ios 125     |  android 125     |  other 126     |  other 

i want total number of users (distinct userid) have platform ios , android, both platforms not per separate. result should 2 in case.

i tried with:

select count(distinct a.grupo1)  mytable b join each     (select userid grupo1       mytable       platform = 'ios'        group grupo1)  on a.grupo1=b.userid 

doesn't work :(

i don't know bigquerry, since tagged question sql assume sql work.

select count(distinct userid) (     select userid      mytable      platform in ('ios', 'android')     group userid     having count(distinct platform) = 2 ) 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -