Share my simple solution

  • 0

    Write your MySQL query statement below

    select Day, round(sum(case when RecordStatus in ('cancelled_by_driver', 'cancelled_by_client') then 1 else 0 end) / count(*), 2)
    as 'Cancellation Rate'
    from (
    select A.Request_at as Day, A.status as RecordStatus
    from Trips A, Users B where A.Client_id = B.Users_Id
    and B.Role = 'client' and B.Banned = 'No'
    and Request_at >= '2013-10-01' and Request_at <'2013-10-04'
    ) temptable
    group by Day

Log in to reply

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