title: Access Query - Update Based on Latest Date
body: <p>I tried to locate an answer for this on other threads and was unable to find one. Please forgive me if it is covered in another thread.</p>
  
  <p>I am relatively new to T-SQL, so please excuse if this is something I should already know.</p>
  
  <p>I have a simple <strong>Access</strong> database with two tables: Contacts and Orders. </p>
  
  <p>Contacts columns are ID (PK), FirstName, LastName, Address, a Status field (identifying if the customer is a "PC", which is who matters in this case), and also has a field for "Delayed." This field is to be "true" for those customers who haven't ordered in the last two months (and "false" for those who have). </p>
  
  <p>The Orders table has the order numbers, along with Customer ID (PK related to Contacts), FirstName, LastName, Date.</p>
  
  <p>I'm trying to write a query to update the "Delayed" field in the Contacts table, based on the latest order date from the Orders table. In this case, update that field to "false" for each PC customer if their latest order date falls within the last 60 days. It seemed pretty striaghtforward, but I'm obviously missing something here. I'm using a SELECT subquery to define the conditions. The query seems to be ignoring my conditions and wants to update ALL rows in the database. Any thoughts?</p>
  
  <pre><code>UPDATE Contacts SET Contacts.Delayed = False
  WHERE EXISTS (SELECT Contacts.FirstName, Contacts.LastName, Contacts.Status, Max(Orders.Date)
  FROM Contacts INNER JOIN Orders ON (Contacts.ID = Orders.ContactID)
  GROUP BY Contacts.FirstName, Contacts.LastName, Contacts.Status
  HAVING Max(Orders.Date) &gt; Date()-60);
  </code></pre>
  
  <p>Any help would be greatly appreciated. </p>