title: MySQL use a variable as repeat value
body: <p>I've got a query against MySQL database as follow:</p>
  
  <pre><code>SELECT id, md5, 
    WHEN md5 = MD5('abc') THEN 'abc'
    WHEN md5 = MD5('def') THEN 'def'
    ELSE NULL
   END AS identity
  FROM url WHERE md5 in (MD5('abc'), MD5('def'));
  </code></pre>
  
  <p>Is there any way to create a variable of sorts to avoid the repetitions? This has to be done without modifying the database and preferable during this single read. It would also be nice to avoid having to calculate the MD5 twice for each value.</p>