help me in the DATE query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alzaabi20xx
    New Member
    • Feb 2007
    • 5

    #1

    help me in the DATE query

    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)
    -----------------------------------------------------------
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    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.

    Comment

    Working...