Search code examples
esper

esper having clause supported in subqueries?


I am writing the following query in esper:

on pattern[every timer:interval(10 sec)] delete from OrderEvent as OE where OE.orderId IN (select orderId from OrderEvent group by orderId having last(orderAction) = CANCEL)

but its giving me a syntax error near having, If not supported then what can be the alternative solution


Solution

  • According to the documentation it looks like the "having" clause is not supported in the subquery. The alternative is to select and cause delete.

    on pattern[..] insert into DELETED_ID select orderId from OrderEvent where orderAction=CANCEL
    on DELETED_ID as del delete from OrderEvent as orderEvent where orderEvent.orderId = del.orderId