title: sql - concatenating case statements
body: <p>I want to do something similar to:</p>
  
  <pre><code>SELECT
     ('['+twt.dept+']' + 
       CASE WHEN twt.typ &lt;&gt; 'EMPTY' AND twt.typ &gt; '' THEN '-['+twt.typ+']' END
       + CASE WHEN twt.subtyp_1 &lt;&gt; 'EMPTY' AND twt.subtyp_1 &gt; '' THEN '-['+twt.subtyp_1+']' END
       + CASE WHEN twt.subtyp_2 &lt;&gt; 'EMPTY' AND twt.subtyp_2 &gt; '' THEN '-['+twt.subtyp_2+']' END
       + CASE WHEN twt.subtyp_3 &lt;&gt; 'EMPTY' AND twt.subtyp_3 &gt; '' THEN '-['+twt.subtyp_3+']' END) AS category
  FROM table1 AS tb1
  JOIN table2 AS twt ON (tb1.id = twt.id)
  </code></pre>
  
  <p>I know I can use coalesce or using stacking cases, but is their anyways to use simpler looking syntax like I have here to achieve this (especially without having a monster case statement for the 5th case)? </p>
  
  <p>PS category is coming back as empty, while i have verified that atleast two of the field above do contain values.   </p>
  
  <p>I am hoping to get something like [shoes]-[sandals]-[pancakes]-[cinnamon bun]</p>