How to get order count by order status in hybris or how to join order and order status?

As part of our daily operations and development, we need to determine the order count by order status to find out how many orders are in a particular status. By using the following query, we can obtain this information quickly in Hybris.

SELECT {status.code} AS status_code, COUNT({o.code}) AS order_count
FROM {Order AS o JOIN OrderStatus AS status ON {o.status} = {status.pk}} GROUP BY   {status.code}

Leave a Comment

Your email address will not be published. Required fields are marked *