title: SQL Query - CASE Unexpected Token
body: <p>I have the following <code>SQL</code> query:</p>
  
  <pre><code>SELECT w.id, w.name, m.subject, m.id 
  FROM users AS w, i_c AS c,
  (SELECT _id, u_id, subject FROM i_m WHERE (_id, tmstmp) IN 
          (SELECT _id, max(tmstmp) FROM i_m GROUP BY _id)) m 
          WHERE (c.uid_1 = '2' OR c.uid_2 = '2') AND 
          CASE WHEN c.uid_1 = '2' THEN w.id = c.uid_2 
          WHEN c.uid_2 = '2' THEN w.id = c.uid_1 END 
          AND (c.id = m.id) ORDER BY m.tmstmp DESC
  </code></pre>
  
  <p>It works fine on my first server but, on a second server, gives me</p>
  
  <pre><code>Unexpected Token. (near "c" at position 280)
  </code></pre>
  
  <p>Looked at some similar issues but still not found solution.
  Seems the problem is <code>CASE</code>.</p>
  
  <p>Could anyone help me? Any help would be much appreciated. Thanks in advance.</p>