title: SQL MAX date with WHERE IN Clause
body: <p>I will give 2 examples, 1st one that works, and the 2nd with what I want to do:</p>
  
  <pre><code>SELECT P.ProjName, D.update_date, SUM(E.pass), SUM(E.fail)
    FROM execution AS E INNER JOIN ( 
      daily AS D INNER JOIN project AS P ON D.project_ID = P.ID )
      ON E.daily_ID = D.ID
    WHERE D.project_id = 25 AND D.update_date = ( 
      SELECT MAX(update_date) FROM daily WHERE project_id = 25; )
    GROUP BY P.ProjName, D.update_date;
  </code></pre>
  
  <p>This will work for individual projects. It gives me the total of Pass and Fails for the latest day of a given project (here, 25).  I would like to grab a group of projects using an WHERE IN clause.  For example (but does not work):</p>
  
  <pre><code>SELECT P.ProjName, D.update_date, SUM(E.pass), SUM(E.fail)
    FROM execution AS E INNER JOIN ( 
      daily AS D INNER JOIN project AS P ON D.project_ID = P.ID )
      ON E.daily_ID = D.ID 
    WHERE D.project_id IN (25,26,28,29,30,31)
    GROUP BY P.ProjName, D.update_date
    HAVING MAX(D.update_date);
  </code></pre>
  
  <p>This will result in every date getting pulled for each of the projects. There are 3 tables involved, 'project' which is linked by 'daily', which is linked by 'execution'.  So, for every project, there is multiple daily data, and each day has multiple execution data.  I realize the HAVING MAX probably needs a comparison, but to what?  Perhaps a modified JOIN will help.</p>
  
  <p>Thanks,
  Keith</p>