Discussion Locked

SQL date error

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

i have an SQL query:
SELECT SUM(TotalHours)
FROM Activity
WHERE Date
BETWEEN #11/10/00# AND #13/10/00#;
the query gives me a result of 256 when upon review of the data the result should be 50 (10 entries of 5 hours each).
Can anyone suggest a theory as to why this error in calculation is happening.
Cheers,
ghost.

3 replies

by lord foul

No i was trying to get the total between the 3 days. I went to the URL and clicked around a bit, good site.
I found the error i was having. The date is entered as dd/mm/yy (Australian standard date format)and upon review of the DB in design mode the default short date is the US version ie mm/dd/yy. So i changed the SQL to the US date version (BETWEEN #10/11/00# AND #10/13/00#)and what do you know, problem solved, the correct answer of 50 was returned by the query.
thanks TTTM
ghost

This discussion is closed to new replies.