题解 | 支付间隔平均值
select CAST((sum(gap) / count(distinct order_id)) AS SIGNED) as gap
from
(
select order_id, ABS(timestampdiff(second, time1, time2)) as gap
from (
select ol.order_id, ol.logtime as time1, sl.logtime as time2
from
order_log as ol join
select_log as sl
on ol.order_id=sl.order_id
) as t
) as t1