Subject | Re: [ib-support] Help - Sum(TimeType) |
---|---|
Author | Markus Ostenried |
Post date | 2002-07-25T23:55:54Z |
At 20:22 Thursday, 25.07.2002 -0300, you wrote:
SELECT EXTRACT(HOUR FROM HoursWorked) + CAST(EXTRACT(MINUTE FROM
HoursWorked) AS FLOAT) / 60
FROM EmployeeTimeWork
"Cast as Float" is needed because otherwise Firebird does a Integer
division instead of floating point.
Then do a SELECT SUM() on the VIEW.
HTH,
Markus
>The Employee work every day in different times, and he can start and stop toYou can create a VIEW that does
>job any time. for example:
>
>In the date 01-Jul-2002 he started at 08:00 am and stop at 11:30 am, so he
>worked 03:30.
>In the date 02-Jul-2002 he started at 08:30 am and stop at 11:45 am, so he
>worked 03:15.
>In the date 03-Jul-2002 he started at 08:15 am and stop at 12:00 pm, so he
>worked 03:45.
>
>I want to pay for him job
>
> Total hours worked: 10:30
> Price by hour: $ 50,00
> Amount: $ 525,00
> EmplyeeID Char(3)
> DateWorked Date
> HoursWorked Time
SELECT EXTRACT(HOUR FROM HoursWorked) + CAST(EXTRACT(MINUTE FROM
HoursWorked) AS FLOAT) / 60
FROM EmployeeTimeWork
"Cast as Float" is needed because otherwise Firebird does a Integer
division instead of floating point.
Then do a SELECT SUM() on the VIEW.
HTH,
Markus