17,378
社区成员
发帖
与我相关
我的任务
分享with table1 as
(
select '2016-08-01 12:00:00' begin_time, '2016-08-03 01:25:36' end_time from dual
)
select begin_time, end_time
, to_char(to_date(begin_time, 'yyyy-mm-dd hh24:mi:ss') + (to_date(end_time, 'yyyy-mm-dd hh24:mi:ss') - to_date(begin_time, 'yyyy-mm-dd hh24:mi:ss'))/2, 'yyyy-mm-dd hh24:mi:ss') avg_time
from table1
如果是多个时间要平均,那就将每个值去减一个固定时间(例如2016-01-01 00:00:00),将这些结果平均,再加上这个固定时间。
我栗子举错了。。。。