Hi!
I have an HQL clause that read's successfully the following statement, but
Code:
SELECT OD.id, sum(PL._plannedAmount)
FROM PlanLines as PL
RIGHT JOIN PL._orderDetail as OD
WHERE
OD._order=:order
GROUP BY OD.id
But this returns me an IList within array of int32, int32.
So after retrieving these items, I have to loop through the recived List and
one by one re-read OrderDetail from database.
Selecting the result as OD and calculation it won't work beacause GROUP BY Cannot handle OD. So I have to manually populate all the OD.properties :(
It would be nice if GROUP BY would accept OD.*
Code:
SELECT OD, sum(PL._plannedAmount)
FROM PlanLines as PL
RIGHT JOIN PL._orderDetail as OD
WHERE
OD._order=:order
GROUP BY OD.*
But not only this produces invalid sql in GROUP BY section there is
something like OD.ID*
The perfect solution would be If I Could write something like this
Code:
SELECT OD, sum(PL._plannedAmount) as {OD.amount}
FROM PlanLines as PL
RIGHT JOIN PL._orderDetail as OD
WHERE
OD._order=:order
GROUP BY OD.*
and the result would come List of OrderDetails and
OrderDetails.amount would be filled with sum or any other calculation value.
Thanks for reading this post!