SELECT Date,
COUNT(DISTINCT(a)),
FROM process
GROUP BY date
SELECT COUNT(*)
FROM (SELECT DISTINCT a, b
FROM process)
TRIED: If I write this:
SELECT Date,
COUNT(DISTINCT(a, b)),
FROM process
GROUP BY date
I get
ERROR: Aggregate functions with DISTINCT cannot be used with arguments of type STRUCT
QEUSTION: I need to count distinct values from "a" and "b" columns. How do I combine 1 and 2 codes?
Columns and Values explained: date: TIMESTAMP (DATE WAS EXTRACTED) a = INT b = STRING
Desired outcome table: date (grouped) : 13.09.2002 distinct(count): 232
if you need to get distinct a, b combinations then this one could help:
SELECT
Date,
COUNT(DISTINCT(CONCAT(a,'_',b))) distinct_a_b
FROM process
GROUP BY date