what i need:
requests are made out of stages, each stage has starts and ends at a certain time.
i need to know how many requests took the same amount of time to complete (sum of delta of all child stages which are in status finished)
the following sql query gives me the result i need, but it has a nested query in the from clause (which is not allowed in hql)
SELECT dist, count(*)
FROM
(
SELECT S.parentRequestId, sum(S.finishedAt - S.startedAt) as dist
FROM blarhg.Stage S
WHERE S.status='FINISHED'
GROUP BY S.parentRequestId
) qin
GROUP BY dist;
how can i achieve the same result in hql?