title: MS Access 2010 SQL Top N query by group performance issue (continued)
body: <p>I have signficant performcance issues (up to time-out) in MS Access 2010 with the query below. The table TempTableAnalysis contains between 10'000-15'000 records. I have already received input from this forum to work with a temporary table in the top 10 query (<a href="https://stackoverflow.com/questions/22717901/ms-access-2010-sql-top-n-query-by-group-performance-issue">MS Access 2010 SQL Top N query by group performance issue</a>)</p>
  
  <p>Can anyone explain how to implement the temporary table in the subquery and how to join it? I can't get it to work.</p>
  
  <p>Any other suggestions to improve performance are highly appreciated.</p>
  
  <p>Here is my query:</p>
  
  <pre><code>SELECT 
  t2.Loc, 
  t2.ABCByPick, 
  t2.Planner, 
  t2.DmdUnit, 
  ROUND(t2.MASE,2) AS MASE, 
  ROUND(t2.AFAR,2) AS AFAR
  
  FROM TempTableAnalysis AS t2
  
  WHERE t2.MASE IN  (
  SELECT TOP 10 t1.MASE 
  FROM TempTableAnalysis AS t1
  WHERE t1.ABCByPick = t2.ABCByPick
  ORDER BY t1.MASE DESC
  )
  ORDER BY
  t2.ABCByPick, 
  t2.MASE DESC;
  </code></pre>