Results 1 to 3 of 3

Thread: Exteacting records on date criteria

  1. #1

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Question Exteacting records on date criteria

    with vb.net + access03

    the table is like this
    employeename
    leavetype
    fromdate
    todate

    i want to extract the records basing on date criteria say for eg:- fromdate is between 01/02/10 and 10/02/10
    query works fine but
    what if a employee is on leave from 31/01/10 to 11/02/10 query won't return this record at all

    actually in the specified period the employee having 10 days of leave from 01/02/10 to 10/02/10

    in such kind of situations how to extract the leave period of an employee
    any guidance please

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Exteacting records on date criteria

    Both the FromDate and ToDate would need to be used in the criteria.

    To find employees on leave within a given date range

    Where FromDate <= EndofDateRange And ToDate >= StartofDateRange

  3. #3
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Exteacting records on date criteria

    If you are not using parameters the dates need to be in either US Standard (mm/dd/yyyy) or ANSI standard (yyyymmdd)
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

Posting Permissions

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



Click Here to Expand Forum to Full Width