title: An SQL Statement to sort within a query
body: <p>I want to develop code that will allow a subset within a query. I have three fields "batchid", "month" and "year". Each batch may have several months and more than one year. The final order I need is the highest month year combination. </p>
  
  <p>The following table I hope illustrates this.</p>
  
  <pre><code>Batch  Month  Year
  5      12     2013
          1     2014
  6      11     2013 
          3     2014
  4       1     2014
          2     2014
  </code></pre>
  
  <p>The required order is</p>
  
  <pre><code>Batch  Month  Year
  5      12     2013
          1     2014
  4       1     2014
          2     2014
  6      11     2013
          3     2014
  </code></pre>
  
  <p>You can see each batch is sorted to the latest date in the batch and each batch is ordered to the latest date in the batch.
  I have got it as far as the year is concerned but cannot figure out the month.
  The first statement determines the lowest and highest dates.</p>
  
  <p>I am new to this forum and for that matter not experienced using VBA and have not beanpole to get the SQL statement into this post so I apologize na hope this may make sense.</p>