oracle 计算时间格式平均值的sql 语句 select to_char((to_date('2019-07-01', 'yyyy-mm-dd') + numtodsinter
select
to_char((to_date('2019-07-01', 'yyyy-mm-dd') + numtodsinterval(avg(begin_time_second), 'second')),'hh34:mi:ss') avg_begin_time,
to_char((to_date('2019-07-01', 'yyyy-mm-dd') + numtodsinterval(avg(end_time_second), 'second')),'hh34:mi:ss') avg_end_time
--2019-07-01 00:00:00 + numtodsinterval(平均数,'秒')转换为日期格式,然后再转换为 时间字符格式
from
(
select
--把上班时间换算为秒
to_char(a.actontime, 'hh34') * 3600 +
to_char(a.actontime, 'mi') * 60 +
to_char(a.actontime, 'ss') as begin_time_second,
--把下班时间换算为秒
to_char(a.actofftime, 'hh34') * 3600 +
to_char(a.actofftime, 'mi') * 60 +
to_char(a.actofftime, 'ss') as end_time_second
from empworkdate a
)
--结束END--
本文标题: Oracle 计算时间格式平均值的sql 语句
本文链接: https://www.lsjlt.com/news/51041.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
2024-05-03
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0