Sorting Dates in Queries

  • Thread starter Thread starter tbd
  • Start date Start date
T

tbd

I have a query where I have formatted a date field to
display the information as mmm/yyyy. However, when I try
to sort this data, it groups all April together and so
forth. The problem here is that the data is spread over
the past four years, and I want to sort the data date
sequentially, i.e Jan 01 followed by Feb 01 etc. How can
I do this,

Thanks in advance for any help!
 
Use an extra field in your query just for the sorting, without displaying
it. The field should be the date field again, formatted as "yyyy/mm";
sorting on it will give you the right sorting.

HTH,
Nikos
 
You should refer to the date column in the ORDER BY clause
without any reformating e.g.

SELECT Format(dateCol, "mmm/yyyyy") etc
FROM etc
ORDER BY dateCol

Hope This Helps
Gerald Stanley MCSD
 
Back
Top