Comparing two time ranges

  • Does anyone know of a method of comparing two time ranges in SQL?

    Example:

    Employee A was scheduled for a lunch between 11:30 AM and 12:30PM

    Employee A actually took lunch between 11:15 AM and 12:15PM

    I need to compare the two time ranges and calculate a variance on the front end if actual start is sched stop.

  • If you were to store the times in datetime fields, then it's simply a comparison. No hard logic other than whatever rules you wish to apply based on the comparison.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Do you have specific rules in mind? If you do, then we might be able to help you build whatever you need. Just try to lay out what you're after (specifically)

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply