About SQL Statement

M

March

Hello,

I want to get the <date> in the right order with using statement below:

"SELECT tDate FROM TempTB ORDER BY tDate;"

For example,

if the list of records has

4/7/2008
4/8/2008
4/9/2008


From above statement, the first record I get is 4/7/2008, next 4/8/2008,
then 4/9/2008.

However, if the list has

4/7/2008
4/8/2008
4/9/2008
4/10/2008


From above statement, the first record I get is 4/10/2008. It' doesn't get
in the right order. This should get 4/7/2008 first.


In my table, I check the order of above list in the order.


Please give me suggestion.

Thank you so much

March
 
M

March

Thank you anyway. I could solve this problem :).

I forgot to put "ASC" in the statement. <Ascending order>

"SELECT tDate FROM TempTB ORDER BY tDate ASC;"


March
 
K

KARL DEWEY

ASC will not do it as it seems your dates are in a text field and not a
DateTime datatype.
Use this --
SELECT tDate FROM TempTB ORDER BY DateValue([tDate ]);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top