select cast(avg(abs(timestampdiff(second,od.logtime,se.logtime)))as signed) as gap from order_log as od left join select_log se on od.order_id = se.order_id