有时候按token字段 distinct 查询出来的数量是0,不是我期望的结果
selectcount(DISTINCT(device_token))frommobile_visit_logs_20150401
数据库中的记录是这样的:
后查阅:参考文章:http://tompig.iteye.com/blog/1563930
coalesce函数表示可以返回参数中的第一个非空表达式
换成下面的语句:
selectcount(DISTINCTCOALESCE(device_token,'NULL'))frommobile_visit_logs_20150401