PDA

View Full Version : Solved: Date Sorting



stanl
03-19-2007, 09:02 AM
I am performing queries on a table and using CopyFromRecordset() to place results into an Excel template for analysis/printing. The data is historical, and for purposes of illustration assume it is grouped by City, Client, InvoiceDate.

I need the SELECT statement to Group by City,Client but within each client be have the InvoiceDate ordered

1/1/2004
1/1/2005
1/1/2006
2/1/2004..... rather than

1/1/2004
2/1/2004
3/1/2004........

I tried creating a non-displayed field Month(InvoiceDate) & Year(InvoiceDate) AS dSort, then using dSort as a Grouping but when run I am asked for a parameter for dSort. I should know this but :banghead: Stan

stanl
03-19-2007, 11:43 AM
Got it. Didn't even require an addtional field just use Int( Month(InvoiceDate) & Year(InvoiceDate) ) in the ORDER BY. I'll mark solved and take a breath next time.

OBP
03-20-2007, 06:03 AM
Stanl, I love it when Posters solve their own problems. :thumb