select
    CAST(avg(abs(timestampdiff(second,o.logtime,s.logtime))) AS UNSIGNED) as gap
from
    order_log o inner join select_log s
    on o.order_id = s.order_id

CAST(...) AS UNSIGNED(包裹四舍五入函数)

功能:将四舍五入后的数值「强制转换为无符号整数类型」