title: Using a subselect in a join using NHibernate
body: <p>I would like to write the following SQl in NHibernate - Detached Criteria if possible.</p>
  
  <pre><code>select * from parent 
  INNER JOIN child on parent.id=child.parentid 
  INNER JOIN 
    (select ChildID, MAX(ChildDate) MaxChildDate from child group by ChildID) max
  ON child.childid, child.ChildDate=max.MaxChildDate
  </code></pre>
  
  <p>This gives me the latest child in every paret. </p>
  
  <p>I can write the sub-query in Critera but cannot perform the double link of ChildID and MaxDate.</p>