title: Complex LINQ SelectMany
body: <p>I have a number of tables I need to join. Tables x,b,c join normally and I'll call that J1.
  Tables x,d are another normal join that I call J2.</p>
  
  <p>Now I need to join J1 and J2 together. For every row in J1 there may be multiple related rows in J2. Table x has a date field among other conditions (which are easy to set up and are in the group join), but I need to get the latest/highest J2 row. Table x has a date field, and basically for every row in J1 I can have multiple rows in J2, and I need to get the most recent one.</p>
  
  <p>I have the joins for J1 in place. The join for J2 is also in place, as first element in a GroupJoin on J1.</p>
  
  <p>Where I am totally lost are two issues:</p>
  
  <ul>
  <li><p>At one point I need to filter out by date. J1*x x entry must be later
  than J1's (there can be older ones).</p></li>
  <li><p>The Select Many needs to take the most recent one, which would implicate some ordering, but I have not been successful at adding a sort. Where do I put that in? I have the GroupJoin, followed by the SelectMany. Where do I put in the OrderBy?</p></li>
  </ul>
  
  <p>Note I require lambda syntax; I can not rewrite it to another form.</p>
  
  <p>Help is appreciated</p>