title: Concatenate Field with Plain Text in CASE used in Select?
body: <p>I may end up having to do this with my PHP on the result set, but I was hoping the DB could do this for me. I'm wanting to check a field and if it matches a condition, set another field equal to another field + a string. Here's my attempts:</p>
  
  <pre><code>SELECT CASE UnityReq WHEN '1' THEN Table + ' (Unity)' ELSE Table END AS Type
  </code></pre>
  
  <p>If the Table were equal to Event, I'd want to get 'Event (Unity)' as Type.</p>
  
  <p>I saw in a different post you have to cast your field if combining with a string, so I tried this:</p>
  
  <pre><code>SELECT CASE WHEN UnityReq = 1 THEN CAST(Table AS NVARCHAR(200)) + ' (Unity)' ELSE Table END AS Type
  </code></pre>
  
  <p>And tried the MySQL CONCAT function:</p>
  
  <pre><code>SELECT CASE UnityReq WHEN 1 THEN CONCAT(Table, ' (Unity)') ELSE Table END AS Type
  </code></pre>
  
  <p>I've also tried both WHEN's with or without the quotes around the number (as it's an INT field), and about every format I've been able to find googling for CASE, but I'm always getting SQL syntax errors. I feel like I've tried every version of this command I can come up with but I'm not having any luck. Any pointers?</p>