title: Multiple SET statements in SQL trigger using CASE?
body: <p>I have a table in my SQL database that includes a column called 'event_attributes.' It is a string and each cell holds something like this:</p>
  
  <pre><code>a:4{s:10:"Discipline";s:7:"Running";s:5:"Level";s:3:"All";s:10:"Instructor";s:13:"Bill Jones";s:3:"Free";s:2:"No";}
  </code></pre>
  
  <p>I am trying to create a trigger that breaks this down into several new columns that look like</p>
  
  <pre><code>Disciple |  Level |  Instructor  |   Free
  -----------------------------------------
  Running  |  All   |  Bill Jones  |   No
  </code></pre>
  
  <p>Using the code below, I can get this to work for ONE set statement.</p>
  
  <pre><code> DROP TRIGGER IF EXISTS `recode`;
   CREATE TRIGGER `recode` 
   BEFORE INSERT ON `wp_em_events` 
   FOR EACH ROW 
   SET NEW.discipline = CASE 
   WHEN NEW.event_attributes LIKE '%Boxing%' THEN 'Boxing' 
   WHEN NEW.event_attributes LIKE '%Climbing%' THEN 'Climbing' 
   WHEN NEW.event_attributes LIKE '%Cycling%' THEN 'Cycling'
   WHEN NEW.event_attributes LIKE '%Yoga%' THEN 'Yoga'   
   ELSE NEW.discipline = NULL 
   END 
  </code></pre>
  
  <p>However, If I add something like:</p>
  
  <pre><code> SET NEW.level = CASE
  
   WHEN NEW.event_attributes LIKE '%All%' THEN 'All'
  
   ....
  </code></pre>
  
  <p>I get a message saying there is an error with my SQL syntax. Anyone know how to nest two or more SET statements into one trigger? Sorry if this is a stupid question - new at this.</p>
  
  <p>Thanks!</p>