Date Sort

klchoy

New member
Local time
Today, 13:58
Joined
Jan 2, 2004
Messages
8
Aaaarrrrggggghhhhh - Date Sort

SOS!
I'm trying to sort a date in a query but it's being sorted alphabetically instead. The query is linked to an excel file via a table. In the excel file, the cell format is set as date format but once I grouped the table by month (via query), it's converted to text (that what I think is happening).

This is the SQL:
SELECT DISTINCTROW [T: 1018].[Material Number], [T: 1018].[Material Description], Format$([T: 1018].[Date],'mmmm yyyy') AS [Date By Month], [T: 1018].Type, Sum([T: 1018].Total) AS [Sum Of Total], Sum([T: 1018].Value) AS [Sum Of Value]
FROM [T: 1018]
GROUP BY [T: 1018].[Material Number], [T: 1018].[Material Description], Format$([T: 1018].[Date],'mmmm yyyy'), [T: 1018].Type, Year([T: 1018].[Date])*12+DatePart('m',[T: 1018].[Date])-1
HAVING ((([T: 1018].Type)="Ethylene"));

Appreciate it if u could give a thorough explaination and solution as I not that good with access or SQL.
 
care to elaborate further? how can i rectify it?
 
Doesn't ( Year([T: 1018].[Date])*12+DatePart('m',[T: 1018].[Date])-1) return an integer, allowing the query to be ordered ?
 

Users who are viewing this thread

Back
Top Bottom