hunger regnuh
08/03/2022, 4:30 PMselect count(*)
from (
select email, SUM(hours) as total
from user_hours
where date between '2022-05-01' and '2022-07-01'
group by email
) as t
where t.total > 10
;
I tried to do
SELECT ... BY ... WHERE SUM(...) > 10
but it seems the SUM(…)
aggregates all values in the dataset, not across the slices, i also tried a SUM(…) … WITHIN
but i need the count of recordsMoises Morales
08/03/2022, 7:49 PMhunger regnuh
08/03/2022, 8:00 PMhunger regnuh
08/03/2022, 8:01 PMMoises Morales
08/03/2022, 8:02 PMhunger regnuh
08/03/2022, 8:03 PMISNULL(metric, 0)
with no luck, is there anyway to return 0, when there’s no data?Moises Morales
08/03/2022, 8:03 PMhunger regnuh
08/03/2022, 8:03 PMMoises Morales
08/03/2022, 8:04 PMhunger regnuh
08/03/2022, 8:05 PM