title: MySQL BEFORE UPDATE trigger - change value
body: <p>So, I've got a MySQL table, named employees.</p>
  
  <pre><code>ID    name    meta
  0     jack    ok
  1     anne    del
  </code></pre>
  
  <p>I want to write a trigger which prevents a row where meta='del' to update the meta field.
  So, if I do:</p>
  
  <pre><code>UPDATE employees SET meta = 'busy' WHERE ID = 0
  </code></pre>
  
  <p>The row should be updated and meta would be 'busy'</p>
  
  <p>But when I do:</p>
  
  <pre><code>UPDATE employees SET meta = 'busy' WHERE ID = 1
  </code></pre>
  
  <p>The meta field should still be 'del'</p>
  
  <p>I tried:</p>
  
  <pre><code>delimiter $$
  CREATE TRIGGER updateEmployees
  BEFORE UPDATE ON employees
  FOR EACH ROW 
  BEGIN
      IF OLD.meta = 'del' THEN
          NEW.meta = 'del'
      END IF;
  END$$
  delimiter ;
  </code></pre>
  
  <p>But MySQL returns with an syntax error. Any ideas?</p>