I have a datetime column in a table, I am performing a select statement on the table and ordering by the datetime column. Previously the order of the data was correct as all the dates were in 2007. However the last few days have seen the introduction of 2008 dates. As a result, the order of the dates as slightly off in that 2008 dates appear at the bottom of the list while 2007 dates appear at the top. Here is the query that I am using:
Mike55.
Code:
SELECT dbo.Timesheets.Id, CONVERT(varchar, dbo.Timesheets.[Date], 103) AS [Date], dbo.Timesheets.Hours,
dbo.Timesheets.Comments, dbo.Timesheets.Offsite, dbo.ParentProjects.Name as Parent, dbo.ChildProject.Name as Child,
dbo.Timesheets.Hour, dbo.Timesheets.Minute, CONVERT(varchar, Hour) + : + CONVERT(varchar, Minute) AS times
FROM dbo.Timesheets INNER JOIN
dbo.StaffList ON dbo.Timesheets.Employee = dbo.StaffList.EmployeeId INNER JOIN
dbo.ParentProjects ON dbo.Timesheets.Parent = dbo.ParentProjects.ProjectID INNER JOIN
dbo.ChildProject ON dbo.Timesheets.Child = dbo.ChildProject.MProjectID
WHERE (dbo.StaffList.Username = @Employee)
ORDER BY dbo.Timesheets.[Date] DESC, Id Desc, times
Mike55.