查询不相同的androidid
select count(distinct androidid) from table where dt='date ' and androidid is not null and androidid <>''
and androidid <> 'null' and androidid <> 'NULL' AND androidid <> '_NULL' AND androidid <> '_Null' and appkey <> 'appkey'; 结果:4055
查询唯一用户 总数 , 因为一个用户是以四个属性为确定唯一值的 ,所以相加然后去重
hive> select count(distinct concat(nvl(idfa, ''), nvl(mac, ''), nvl(imei, ''), nvl(androidid, '')) ) from table where dt='date' and appkey <> 'appkey'; 结果: 23235487
根据appkey分组,然后查询不同的idfa有多少个。
select appkey, count(distinct lower(idfa)) from table where dt='date' and idfa is not null and idfa <>'' and lower(idfa) <> 'null' and lower(idfa) <> 'NULL' AND lower(idfa) <> '_null' AND lower(idfa) <> '_null_' group by appkey ;

894

被折叠的 条评论
为什么被折叠?



