Leetcode 262. 行程和用户(avg函数的巧用)

2021-04-08 13:33:40 浏览数 (1)

代码语言:javascript复制
select request_at "Day",round(avg(`status`!="completed"),2) "Cancellation Rate"
    from trips t 
        join users u1
            on u1.users_id=t.client_id and u1.banned="No"
        join users u2
            on u2.users_id=t.driver_id and u2.banned="No"
where request_at between "2013-10-01" and "2013-10-03"
group by request_at

0 人点赞