SUM time intervals...AGGREGATE DAY... then WEEK
Posted on 2003-03-03
THIS IS A TIME SLIP SCENARIO...using ASP and SQL SERVER 2000
For an employee time slip system I have the following fields in a table called NONEXMPT:
What I would like to do is SUM the time for morning and then the afternoon, and then SUM those SUMs for a total for the week.
OutMONamHour - InMONamHour = MONam
OutMONpmHour - InMONpmHour = MONpm
MONam + MONpm = MON
MON + TUE + WED (and so on to end with) = WEEK TOTAL
THIS IS WHAT I HAVE SO FAR...
SELECT (InMONpmHour - OutMONamHour) AS MON FROM nonexempt WHERE username = username AND (ID) = (select max(ID) from nonexempt)
Any help is appreciated, JV