Sharing my solution


  • 0
    R

    Re: [Sharing my solution]

    select O.Request_at as Day,coalesce(sub.cancellation_rate,0.00) as "Cancellation Rate" from  trips O left outer join (
    select t1.Request_at,Round(count(t1.status)/cnt.cr,2) as cancellation_rate from
    trips t1,
    users u1,
    (select t.Request_at,count(t.status) as cr  from trips t,
    users s
    where t.client_id=s.users_id 
    and s.banned='no'
    group by t.Request_at) cnt
    where t1.Request_at=cnt.Request_at
    and t1.client_id=u1.users_id
    and t1.status like 'cancelled%'
    and u1.banned='no'
    group by t1.Request_at) sub
    on O.Request_at=sub.Request_at
    group by Day,"Cancellation Rate"
    

Log in to reply
 

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