Guys, need some help this is my code

    Select * Table1 ORDER BY Date DESC

My problem is I code in descending order but its not descending order because I try to add a Data instead of
5/6/2013 is the first item that i will see. 1/1/2012 can be appear.

Sorry for my english..

If the order is

5/6/2013
1/1/2012

That is in descending order.

if you want

1/1/2012
5/6/2013

Then you want ascending order, not descending.

Edited 3 Years Ago by Ancient Dragon

what database are you using? you should be carefull with reserved word. I'm afraid that date is reserved word. I suggest changing field name, with something save like dt_input, or date_birth, etc. and something off with your query, it miss the from keyword.
try putting bracket like this

select * from table1 order by [date] desc (if you are using SQL Server)

I solved this problem thanks guys for the help.

@ricky
yeah when you use sql server you may need be carefull with your field name.
I try to convert my data type then it works.
from varchar to datetime

I thought it was already date type, not varchar. That makes more sense why it didn't work. As varchar the dates are parsed from left to right just like any other ordinary string. So 5/1/2013 is parsed differently from 05/01/2013 or 5/1/13. To parse varchar like date the string must be in YYYYMMDD or YYYY-MM-DD format. This is also true of file names -- if your program creates file names based on date and you want the files to appear in ascending order then the file names must be in YYYYMMDD format, otherwise they will not be sorted correctly.

Edited 3 Years Ago by Ancient Dragon

Sorry, sir thats why I set up varchar into my field DATE because i want to add into my database is this format 5/6/2013. Then when I'm apply the datetime data type this is the format when I add
5/6/2013 12:00:00 AM, so when i call mt data in database can be appear all of that so thats why I changed the data type to solve my problem.

This article has been dead for over six months. Start a new discussion instead.