Order by descending date - month, day and year

前端 未结 6 599
Happy的楠姐
Happy的楠姐 2020-12-05 03:45

This seems stupid but, I simply need a list of dates to be ordered with the most recent date at top. Using order by DESC doesn\'t seem to be working the way I w

6条回答
  •  天涯浪人
    2020-12-05 04:40

    Assuming that you have the power to make schema changes the only acceptable answer to this question IMO is to change the base data type to something more appropriate (e.g. date if SQL Server 2008).

    Storing dates as mm/dd/yyyy strings is space inefficient, difficult to validate correctly and makes sorting and date calculations needlessly painful.

提交回复
热议问题