title: Check 3 columns against each other in SELECT
body: <p>I have a <code>SELECT</code> statement with 3 columns and want to compute a fourth column from them.</p>
  <ol>
  <li>If Column1 has a value, then Column4 = Column1</li>
  <li>If not 1. and Column2 has a value, then Column4 = Column2</li>
  <li>If not 2. and Column3 has a value, then Column4 = Column3</li>
  <li>If not 3. NULL</li>
  </ol>
  <p>Basically, look from Column1 to Column2 if you find a value and put the first one into Column4.</p>
  <p>I can do it with 2 columns easily:</p>
  <pre><code>SELECT 
      CASE 
         WHEN (Column1 IS NOT NULL AND Column1 &lt;&gt; '') 
            THEN Column1 
            ELSE Column2 
      END 'Column4'
  </code></pre>
  <p>But I know of no way how to incorporate <code>Column3</code> into that logic. Only think I can think of right now is to store the result as a temptable or view and then do another <code>SELECT</code> that compares the found value with <code>Column3</code>.</p>
  <p><strong>Important</strong>: all 3 columns can have all possible combinations of string, NULL, ' ' or ''</p>