Hello,
I would like to map/fetch a max date from the many side of a 1:m relationship. So when I fetched a Customer, for instance, the MAX order date for all Orders related to the Customer would be populated in a MaxOrderDate field of that Customer object.
The SQL would look like this:
Code:
select c.CustomerName, c.CustomerPhoneNumber, (select max(DateOrdered) from Orders where CustomerID = c.ID) as MaxOrderDate from Customers c
Does anyone know of a way to do this without writing the HQL or SQL?
Many thanks!