title: UPDATE field with CASE statement match or do nothing to that field while still updating other fields in SQL
body: <p>I need to get this UPDATE query to change my "offer_period" field (datetime) value to NOW() only if the offer_period field's value is greater than NOW(). The problem is, regardless of this field, I need to update my "status" field no matter what.</p>
  
  <p>Because the status field must be updated, I cannot change the WHERE clause to include any offer_period condition or the status field won't get an update if that condition is not met.</p>
  
  <p>With the below query, the ELSE statement is causing me problems. If I ommit it, the offer_period field value will be changed to NULL if the CASE condition is not met, which is bad because I want it to do nothing in these instances. So I tried including the ELSE condition that updates with the existing offer_period value, but the results then say 0 rows were affected. So this is where I'm stuck.</p>
  
  <p>Thanks for taking the time.</p>
  
  <p>Josh</p>
  
  <pre><code>UPDATE listings
  SET `status`= 'Pending'
      , offer_period = CASE
                         WHEN offer_period &gt; NOW() THEN NOW()
                         ELSE offer_period
                       END
  WHERE listing_id=1
      AND agent_id=1
  </code></pre>