ORDER BY DATE showing NULLS first then most recent dates

前端 未结 8 1356
无人共我
无人共我 2020-11-29 07:21

I have a stored procedure which executes a select statement. I would like my results ordered by a date field and display all records with NULL dates first and then the most

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-29 07:49

    try this

    SELECT a,b,c,[Submission Date] FROM someView ORDER BY isnull([Submission Date] ,cast('1770/01/01' as datetime)) ASC

提交回复
热议问题