Subject Re: [firebird-support] calculating sum of times
Author Martijn Tonies

> I have the following table
> ID Time1 Time2 TotalTime
> Time1 and Time2 are posted by stored procedure. Then
> in the end of processing i am doing
> UPDATE MyTable SET TotalTime = Time2 - Time1
> Am i right to assume that TotalTime will now hold the amount
> of time passed since Time1 till Time2?

Yes. But what datatype is "totaltime" then? Cause it cannot be of
the TIME or TIMESTAMP datatype. Totaltime would hold a
"duration", not a "time".

> Now...I need to calculate SUM(TotalTime) for all records in a table..
> And get the hours...How do i go about that?

See above. Calculate the duration in some specific format (given that
Firebird doesn't have a datatype for duration) and calculate the number
of hours.

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Upscene Productions
Database development questions? Check the forum!