title: Case Statement comparing multiple dates
body: <p>I have read more of these questions then I care to admit in regards to this matter, however, everything I try from the answers found here still fails. So here we go...</p>
  
  <p>I am trying to compare multiple dates from multiple tables to find the most recent date. The joins in the query work fine as I'm doing other comparisons and they work fine. However, whenever I try to run this case I get no syntax errors or anything it simply falls through to the ELSE even though conditions were met. This is on SQL Server 2008R2.</p>
  
  <p>Code:</p>
  
  <pre><code>SELECT
  [OTHER COLUMNS],
  'MOST_RECENT_DATE' = Case
      WHEN A.Date &gt; B.Date AND A.Date &gt; C.Date AND A.Date &gt; D.Date THEN convert(varchar, A.Date,30)
      WHEN B.Date &gt; A.Date AND B.Date &gt; C.Date AND B.Date &gt; D.Date THEN convert(varchar, B.Date,30)
      WHEN C.Date &gt; A.Date AND C.Date &gt; B.Date AND C.Date &gt; D.Date THEN convert(varchar, C.Date,30)
      WHEN D.Date &gt; A.Date AND D.Date &gt; B.Date AND D.Date &gt; C.Date THEN convert(varchar, D.Date,30)
      ELSE 'ATTENTION'
  END
  FROM TABLE E
  LEFT JOIN TABLE A ON E.other = A.other
  LEFT JOIN TABLE B ON E.other = B.other
  LEFT JOIN TABLE C ON E.other = C.other
  LEFT JOIN TABLE D ON E.other = D.other
  </code></pre>
  
  <p>When I put in a single comparison it works and returns me the date ie.</p>
  
  <pre><code>CASE
      WHEN A.Date &gt; B.Date THEN CONVERT(varchar,A.Date,30)
      ELSE 'WHATEVER'
  END
  </code></pre>
  
  <p>So the issue has to lie in the multiple comparisons, I may have just been staring at this to long and need to walk away but I can't for the life of me figure out why this is falling through to the else when I know the condition is met.</p>
  
  <p>Thoughts and considerations are greatly appreciated in advanced. If anyone would like more information or if I need to make myself clearer please let me know.</p>