title: UPDATE after an INNER JOIN
body: <p>I have the following tables:</p>
  
  <p>Table1:</p>
  
  <pre><code>id   name    race_type        start_time              end_time
  ---  ----    ---------        ----------              --------
  111  Phelps   Relay       2016-08-20 00:01:00           NULL
  111  Phelps   Relay             NULL             2016-08-20 00:02:00
  333  Lochte  Butterfly    2016-08-20 00:05:00           NULL
  333  Lochte  Butterfly          NULL             2016-08-20 00:06:00
  </code></pre>
  
  <p>Table2:</p>
  
  <pre><code>name      race_type        current_time       qualifies
  ----      ---------        ------------       ---------
  Phelps      Relay       2016-08-20 00:03:30    
  Lochte    Butterfly     2016-08-20 00:05:30
  </code></pre>
  
  <p>I use the following query to determine if the CURRENT_TIME for the two transaction in Table2, falls within the START_TIME and END_TIME of Table1 records with respect to each unique ID pairing, name, and race_type.</p>
  
  <pre><code>SELECT * FROM (
  SELECT id,name,race_type, MIN(start_time) AS start_time, MAX(end_time) AS end_time
  FROM Table1
  GROUP BY id
  ) AS results INNER JOIN table2 ON 
    results.name = Table2.name 
    AND results.type = Table2.type 
    AND Table2.current_time BETWEEN results.start_time AND results.end_time;
  </code></pre>
  
  <p>How would I modify this query to UPDATE the Table2.qualifies parameter to either true or false based on whether there were results returned or not for the two transactions in Table2</p>
  
  <p>Table2 should look like this after the modification:</p>
  
  <pre><code>name      race_type        current_time       qualifies
  ----      ---------        ------------       ---------
  Phelps      Relay       2016-08-20 00:03:30       0    
  Lochte    Butterfly     2016-08-20 00:05:30       1
  </code></pre>
  
  <p>I'm guessing I need to add an UPDATE along with exists somewhere?</p>