SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru Angry Coder's Avatar
    Join Date
    May 2002
    Location
    Canada
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Oracle: What's wrong with this statment again? (between 2 dates)

    Hello,

    Sorry for bothering you with my endless questions...

    I have a table named: pr_official_vacation and I want to select any current employee on vacation...

    I have the fallowing record with the emplyee ID: 4815:

    EMPID: 4815
    START_DATE: 05-JUN-04
    END_DATE: 07-JUN-04


    Code:
    SELECT COUNT(*) AS total5 FROM pr_official_vacation WHERE EMPID = '4815' AND START_DATE >= to_date('06/04/04' ,'mm/dd/yy') AND END_DATE <= to_date('06/04/04' ,'mm/dd/yy')


    TOTAL5 is 0 always

    Please tell me what's wrong?

    Thank you...
    Why It Doesn't Work?!

  2. #2
    SitePoint Guru Angry Coder's Avatar
    Join Date
    May 2002
    Location
    Canada
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never mind... problem solved.

    I am sorry for writing it before I revise the code well... I have a project in a forign country and the flight date is very soon!
    Why It Doesn't Work?!

  3. #3
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Kent
    Posts
    1,921
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I take it you spotted that the end date couldn't be less than or equal to the start date, and still pick up someone with an end date that was greater than the start date
    i.e. more than one day off, that one day being your 06/04/04


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •