サンプルテーブル
- テーブル定義
| Column | Type |
|---|---|
| time_onsite | time |
- データ
| time_onsite |
|---|
| 00:00:01 |
| 00:01:00 |
| 01:00:00 |
time型を秒に変換
select
time_onsite,
time_to_sec(time_onsite) as sec
from
time_table
;
| time_onsite | sec |
|---|---|
| 00:00:01 | 1 |
| 00:01:00 | 60 |
| 01:00:00 | 3600 |
time型の合計
select
sum( time_to_sec(time_onsite)) as total_sec,
sec_to_time(sum( time_to_sec(time_onsite))) as total_time
from
time_table
;
| total_sec | total_time |
|---|---|
| 3661 | 01:01:01 |