Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sql query

Author  Topic 

westlondonsun
Starting Member

1 Post

Posted - 2005-10-14 : 07:49:43
hi

on my dynamic webpage i am calling in the content of one of my sql tables. in the table is a field called expenses_date. this is in the format of dd/mm/yyyy, i do a SOrder by Desc expenses_Date.

the dates are returned onto the webpage in dd desc date and not the full date,

so eg
11/05/2005
15/06/2005
18/04/2005
20/09/2004

this shows me that it is looking at only the dd part of the date and putting that into order.
it should be like the following

15/06/2005
11/05/2005
18/04/2005
20/09/2004

Any ideas?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-14 : 07:53:19
What is the datatype of expenses_Date?
If it is DateTime column then there wont be any problem in sorting
Otherwise you need to sort it by converting it into DateTime

Select columns from yourTable Order by Convert(DateTime,expenses_Date) Desc

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -