title: SubQueries in MS ACCESS: selecting only one record per "person" per date
body: <p>I am using a table called analyzed in Microsoft Access. It has many fields but the three ones being used for filtering in this case are analyzed.readings_miu_id, analyzed.ReadDate, analyzed.ReadTime. I need to pull the records from the "analyzed" table where readings_miu_id are grouped together then sorted by ReadDate but showing only the last entry for said date which could be the highest valued time in ReadTime. I've created a query:</p>
  
  <pre><code>SELECT readings_miu_id, Reading, ReadDate, ReadTime, 
      MIUwindow, SN, Noise, RSSI, OriginCol, ColID, Ownage
  FROM analyzed
  WHERE analyzed.ReadDate Between #4/21/2009# and #4/29/2009#  
  AND analyzed.ReadTime= ( 
      SELECT TOP 1 analyzed.ReadTime 
      FROM analyzed 
      WHERE analyzed.readings_miu_id = *????*** 
      ORDER BY analyzed.ReadTime DESC);
  </code></pre>
  
  <p>*????*** is being used to show that im not sure what to put here</p>
  
  <p>if i enter in a valid readings_miu_id i get one record with the highest time for that readings_miu_id.</p>
  
  <p>How do i use a sub query like the one above to pull only the last ReadTime per readings_miu_id per ReadDate? </p>
  
  <p><em>readings_miu_id</em> is not the table ID, it is more similar to an Item Number or a Name</p>