troubleshooting Question

SQL - ORDER BY Date that is converted to String

Avatar of CipherIS
CipherISFlag for United States of America asked on
SQLMicrosoft SQL Server
8 Comments1 Solution52 ViewsLast Modified:
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'

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.
ASKER CERTIFIED SOLUTION
lcohan
Database Analyst
Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros