Count Group By Results



Hi everyone.

I have a db that contains the following:

time, Status (“ready”,“running”,“stopped”), Address(“a1”,“a2”…)

So to get the latest status of each address and to filter it I did the following:

SELECT last(“Status”) FROM db GROUP BY “Address”
WHERE “last” = ‘running’ GROUP BY “Address”

That works, but I want to count now how many are running. How would you do that? I should aggregate now over the results.

Thanks for the help.