title: mysql case in update statement with REPLACE
body: <p>I currently have something like this:</p>
  
  <pre><code>UPDATE table1  SET column1 = REPLACE(column1, 'abc', 'abc1') WHERE column1 LIKE '%abc%';
  UPDATE table1  SET column1 = REPLACE(column1, 'def', 'def1') WHERE column1 LIKE '%def%';
  </code></pre>
  
  <p>I am trying to consolidate these into a single update statement and am trying the following:</p>
  
  <pre><code>UPDATE table1
  SET column1 = 
  CASE
  WHEN column1 LIKE '%abc%' THEN REPLACE(column1, 'abc', 'abc1')
  WHEN column1 LIKE '%def%' THEN REPLACE(column1, 'def', 'def1')
  ELSE column1
  END;
  </code></pre>
  
  <p>Is this the correct way of doing this? I am new to case/when. Thanks!</p>