My solution with 178 ms


  • 0
    Z

    select Request_at as Day, round(sum(status)/count(Id),2) AS Cancellation Rate
    FROM
    (SELECT A.Id, A.Request_at,
    case when A.Status = "completed" then 0 else 1 end as status
    FROM Trips A
    LEFT JOIN Users B
    ON (A.Client_Id = B.Users_Id)
    WHERE B.Banned = "No" and date(Request_at) between '2013-10-1' and '2013-10-3') C
    GROUP BY Request_at
    ;


Log in to reply
 

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