I need to count distinct date in one column but I do not want to group by that.
Datasource table:
ID zip5 date volume
11 11111 01/03/16 5
12 11111 01/03/16 6
13 11111 01/04/16 7
My code:
Select zip5, count(ID), count(distinct (date)), sum(volume),
from table
group by zip5
Desired output:
zip5 count(ID) count(distinct (date)) sum(volume)
11111 2 1 11
11111 1 1 7
However, what I got is:
zip5 count(ID) count(distinct (date)) sum(volume)
11111 3 3 18