By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

help me in the DATE query

P: 5
hello everyone
i hope you could help me in this query.

i build a query which you give it a month and a year and after it will calculate the overtime of that month (choosen month & year).

my problem is:
ex: if i pick this date (1) then it will calculate it correctly and will give me the result = 20 that's ok, but if i pick this Date (2) them it will calculate the (1) and (2) and will give me the result = 50.

i don't know what is the problem with my Query i hope you help me with it and i appreciatte it.

my Query:

- from IDbox i will take the ID of the employee.
- month variable which it will take the month that you choose.
- year variable which it will take the month that you choose.

[PHP]
select sum(Overtime) from Evaluation where EmpID = '" & IDbox.text & "' and Date between '#1/" & month & "/" & year & "#' and '#1/" & month & "/" & year & "#' "
[/PHP]

ex: this is an example

----------------------------------------------------------
Date | Overtime
-----------------------------------------------------------
2/2/20005 | 20--------------------(1)
-----------------------------------------------------------
3/2/2005 | 30---------------------(2)
-----------------------------------------------------------
4/4/2005 | 10---------------------(3)
-----------------------------------------------------------
May 7 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 5K+
P: 8,434
I think the problem is your date format. SQL standards state that dates are always U.S. format - that is, month first.

Check here for more details.
May 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.