When I use count by using partition by, I get one extra number in my count. Whereas, when I count by using group by clause I get one less. Why is that?
Thanks in advance.
Partition by query;
Select distinct market_location,
count(distinct case when upper(source_method) = 'abc' and upper(source_name) ='AIM' then client_number else 0 end) over (partition by market_location)
from table1
result = 56
Group by query;
SELECT market_location, count(distinct client_number)
from table1
where upper(source_name) = 'AIM'
and upper(source_method) = 'abc'
by market_location
result = 55