Bigquery select distinct values

前端 未结 6 852
离开以前
离开以前 2021-01-11 10:03

How to select distinct values in Google Bigquery?

Query:

SELECT DISTINCT cc_info
FROM user
WHERE date = ?

Thanks!

6条回答
  •  时光说笑
    2021-01-11 10:49

    Simply use group by,

    SELECT cc_info
    FROM user
    WHERE date = ?
    GROUP BY cc_info
    

    If you want to COUNT over DISTINCT values you can use,

    SELECT COUNT(DISTINCT cc_info)
    FROM user
    WHERE date = ?
    

提交回复
热议问题