Hey there
I can't get my query running... given following mapped Object with following fields:
MyObj.FK_Id (Foreign-Key, not Unique)
MyObj.CreateDate
I would like to get all objects grouped by FK_Id, from each group the latest (youngest) one.
I thought I could presort my Objects with a subquery, but 'FROM' does unfortunately not wok on subqueries:
Code:
hql = "SELECT COUNT(oH) FROM " &
"(SELECT iH FROM Model.MyObjAS iH ORDER BY ORDER BY iH.CreateDate) AS oH " &
"GROUP BY oH.FK_Id"
Can you help me out with the right query?
sl3dg3