题解 | 支付间隔平均值

支付间隔平均值

https://www.nowcoder.com/practice/847431ad931e45348eb1ab5657144c28

with t1 as 
(
    select 
    order_log.order_id,
    order_log.time as or_time,
    select_log.time as sel_time,
    abs(timestampdiff(second,order_log.time,select_log.time)) as time_diff
    from
    select_log  left join order_log  on  order_log.order_id = select_log.order_id
    where 
    select_log.time is not null and order_log.time is not null
)
SELECT 
    CAST(AVG(COALESCE(time_diff, 0)) AS SIGNED) AS gap
FROM t1;

全部评论

相关推荐

Gardenia06...:刚开始学是这样的,可以看看左神和灵神都讲的不错
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务