select cast( round( avg( abs(timestampdiff(second,o.logtime,s.logtime)) ),0) as signed) gap from order_log o join select_log s using(order_id,uid,product_id)

select cast( round( avg( abs(timestampdiff(second,o.logtime,s.logtime)) ),0) as signed) gap from order_log o join select_log s using(order_id,uid,product_id)