Avatar of CipherIS
CipherIS
Flag for United States of America

asked on 

SQL - ORDER BY Date that is converted to String

I write a SQL SELECT statement and formatting the date.  I want to order it by the date.
Select Field1, Field2, CONVERT(VARCHAR, Field3, 101) As MyDate 
FROM MyTable
ORDER BY MyDate, Field1, Field2
WHERE MyDate >= '11/1/17'

Open in new window


The problem is that MyDate is sorting it by
01/01/3000
02/01/2017
....
11/01/2016

I want the 11/01/2016 to appear first and then every other date in order after that.
SQLMicrosoft SQL Server

Avatar of undefined
Last Comment
Vitor Montalvão

8/22/2022 - Mon