Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL ORDER BY a date?

Status
Not open for further replies.

hpvic03

Technical User
Aug 2, 2006
89
0
0
I have a database with dates and I want to output a query with the results sorted by their dates... I am using a Microsoft Access database. The field type is listed as text, but it is always validated by colfusion as a date before it is entered. Anyway when i output the info it just goes in alphabetical order by months (lol), so how do i get this to work?
 
If the Access field type is text, you get alphanumeric sorting on the ORDER BY clause. You'll have to either change the data type or convert the text contents into a date type field in your query, then order by that converted field.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'll have the roast duck with the mango salsa.
 
how do i change it into a date type field?
 
nvmd i got it.. thanks! i just changed the database value to date. for some reason i didn't work before when i tried to do an insert so i changed it.. anyway it works now, so thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top