title: Ms-Access GROUP BY, TOP query
body: <p>I am using the following query on a .mdb file with the following results.</p>
  
  <pre><code>SELECT tableA.id, tableA.type, tableA.date, SUM(tableA.val) AS total, tableB.SumB
  FROM tableA LEFT JOIN tableB ON tableB.id = tableA.id
  GROUP BY tableA.id, tableA.type, tableA.date, tableB.SumB ;
  </code></pre>
  
  <p>results:</p>
  
  <p><img src="https://i.stack.imgur.com/L99pd.jpg" alt="enter image description here"></p>
  
  <p>I need only the first record from the group of records with the same <code>type</code> and <code>date</code>.</p>
  
  <p>I would use <code>DISTINCT</code> but the problem is that I have a different field (in this example <code>id</code>).</p>
  
  <p>Any suggestions?</p>
  
  <p>Thanks</p>
  
  <p>P.S. Case 2:</p>
  
  <p>Ids are the same for the red records but we have an additional column 'name' with different string values.</p>