title: EF Query Help - Grouping and Sub queries
body: <p>I have data table (DOCs, which is the DBSet in my context) with below data</p>
  
  <pre><code>ID   Code   Rev
  1    A1     1
  2    A1     2
  3    A1     3
  4    A3     1
  5    A2     1
  6    A2     2
  </code></pre>
  
  <p>I need to select the records which has a records for each Code which has the highest Rev. My expected result is </p>
  
  <pre><code>ID   Code   Rev
  3    A1     3
  6    A2     2
  4    A3     1
  </code></pre>
  
  <p>The ID column is the PK of the table and Code+Rev is unique.<br/>
  Note: There are other fields in the table which i need to get for the result. Ideal would be to get a iqueryable (Doc is the model class), i was think of selecting the ID within an inner query and then use that to get the iqueryable of docs.</p>
  
  <p>Thanks in Advance</p>