First: Table, which contains times. “tbl_time” with field “MyTime”
Second: Query for the seconds
SELECT HOUR( "MyTime" ) * 3600 +
MINUTE( "MyTime" ) * 60 +
SECOND( "MyTime" ) AS "MySeconds"
FROM "tbl_time"
Query could be a subquery of the following query:
SELECT SUM( "MySeconds" ) AS "SumMySeconds" FROM "qry_seconds"
Both queries could be subqueries of the following query:
SELECT "SumMySeconds" / 3600 AS "MyHours",
MOD( "SumMySeconds", 3600 ) / 60 AS "MyMinutes",
MOD( MOD( "SumMySeconds", 3600 ), 60 ) AS "MySeconds"
FROM "qry_sum_seconds"
and all this queries could be subqueries of the last query:
SELECT CAST( "MyHours" || ':' || "MyMinutes" || ':' || "MySeconds" AS TIME )
AS "HMS" FROM "qry_sum_HMS"
Note: It will be shown as a decimal number in query editor this way, but it is a time value. So you could extract hours, minutes and seconds from this value later.
Be careful with last query. Set COALESCE or IFNULL, if there might be empty fields.
AddingTimes.odb (4.2 KB)