Hello group,
I've read through the docs and can't seem to get the syntax right on
this one...

I'm using NH 2.1.2.4000

I have an object called Fund and it has a collection of FundDetail
objects exposed as the property FundDetailList.
What I need to return is a list of Fund.Id, Fund.Name,
FundDetail.FinancialReportingDate for every Fund but with the most
recent (max) FundDeail.FinancialReportingDate of each Fund.

I've tried this HQL stmt but to no avail:
   select f.Id, f.Name, dl.FinancialReportingDate from Fund f,
elements(f.FundDetailList) dl where
    dl.FinancialReportingDate = select max(dl2.FinancialReportingDate)
from Fund f2, elements(f2.FundDetailList) dl2

I got this HQL to work; which is coming at it from the many-to-one
side but I don't think it's the best way:
  select fd.Fund.Id, fd.Fund.Name, max(fd.FinancialReportingDate) from
FundDetail fd group by fd.Fund.Id,
   fd.Fund.Name"

I'd like to go about this using the first example I posted but I can't
get the syntax right.

Any ideas???

Thanks.

Regards,
Mike

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to