Accepted Code


  • 0
    D

    select
    a.Request_at Day,
    round(sum(a.is_cancelled)/count(a.Request_at), 2) "Cancellation Rate"
    from
    (
    select
    t.Request_at
    ,case
    when t.Status != 'completed' then 1 else 0 end as is_cancelled
    from Trips t
    inner join Users u
    on t.Client_Id = u.Users_id
    where t.Request_at between '2013-10-01' and '2013-10-03' and u.Role = 'client' and u.Banned = 'No'
    ) a
    group by a.Request_at


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.