How to select distinct values in Google Bigquery?
Query:
SELECT DISTINCT cc_info
FROM user
WHERE date = ?
Thanks!
SELECT COUNT(DISTINCT cc_info)
FROM user
WHERE date = ?
is NOT the right query, because DISTINCT
is a statistical approximation and is not guaranteed to be exact. See https://cloud.google.com/bigquery/docs/reference/legacy-sql#countdistinct
So better approach is
select EXACT_COUNT_DISTINCT(cc_info) from user where date = ?