guster5k
asked on
SQL String to sort Date & Time on the same field as Date Desc. and Time Asc.
I have a Date & Time field in access, i'd like a SQL string to sort the records by Date (i.e.: from today to 1 week ago) and then by time , but from 10am to 7pm (i believe it's ascending?).
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Nice one Lowfatspread !
ASKER
I'd like to have something like:
ORDER BY DATE DESC AND TIME ASC
01/06/04 10:00AM
01/06/04 11:00AM
01/06/04 12:00PM
01/06/04 1:00PM
01/06/04 2:00PM
01/05/04 10:00AM
01/05/04 11:00AM
01/05/04 12:00PM
01/05/04 1:00PM
But the problem is that the date & time are on the same field.
Thanks a lot
ORDER BY DATE DESC AND TIME ASC
01/06/04 10:00AM
01/06/04 11:00AM
01/06/04 12:00PM
01/06/04 1:00PM
01/06/04 2:00PM
01/05/04 10:00AM
01/05/04 11:00AM
01/05/04 12:00PM
01/05/04 1:00PM
But the problem is that the date & time are on the same field.
Thanks a lot
Lowfatspread has posted a working solution to your problem
Did you try it ??
Did you try it ??
ASKER
Yes :)
Access has an excellent Help file, if you look up these terms you should be able to put together the necessary query:
DatePart, DateAdd, DateDiff
SELECT CustomerHistory.DateOfSale
FROM CustomerHistory
WHERE (((CustomerHistory.DateOfS
ORDER BY CustomerHistory.DateOfSale