that's true. depends what you want returned when datecol2 is null. assuming datecol1 then a coalesce thrown in there should work:select case when datecol1 < datecol2 then datecol1 else coalesce(datecol2,datecol1) end as EarlyDatefrom ( select getdate() as datecol1, getdate()-1 as datecol2 union all select getdate()-1, getdate() union all select null, getdate() union all select getdate(), null ) doutput:EarlyDate-----------------------2013-03-13 15:09:43.2472013-03-13 15:09:43.2472013-03-14 15:09:43.2472013-03-14 15:09:43.247
Be One with the OptimizerTG