user955732
user955732

Reputation: 1370

Multiple count in single statement (esper epl)

I am trying to create an epl statement using esper for monitoring response times, something like this:

SELECT QUEUENAME, count(latency>1000) AS NUMBER_OF_SLA_BREACHES, COUNT(latency) AS TOTALS FROM ResponseWindow GROUP BY QUEUENAME

.. however the two count() gives same results, which is incorrect.
Thanks for any help correcting this query!

Upvotes: 0

Views: 334

Answers (1)

xpa1492
xpa1492

Reputation: 1973

You need to add the filter as a second parameter to the count aggregation function like this:

SELECT QUEUENAME, count(*,latency>1000) AS NUMBER_OF_SLA_BREACHES, COUNT(latency) AS TOTALS FROM ResponseWindow GROUP BY QUEUENAME

Upvotes: 1

Related Questions