• Assuming that column1 cannot be null, then this will give the same results and should be slightly faster.

    CASE

    WHEN column2 > column1

    THEN column2

    ELSE column1 END AS Result

    You have three conditions:

  • column2 is null
  • column1 > column2
  • column2 > column1
  • , and you want column1 returned under two of those conditions, so you want to test for the one condition where you're not returning column1.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA