Question towards problem description


  • 9
    T

    The question says "Write a SQL query to find the cancellation rate of requests made by unbanned clients". Why does the solution need to count the cancellations made by both clients and drivers, considering the the fact that it doesn't ask us to filter out banned drivers?


  • 0
    Y

    select DISTINCT T.Request_at,round(count(case when T.status<>'completed' then T.status else null end)/count(1),2)
    from (
    select Request_at
    ,Driver_Id
    ,Client_Id
    ,status
    from Trips where Request_at between '2013-10-01' and '2013-10-03') T
    inner join (select Users_Id,Banned from Users) U
    on (U.Banned = 'NO' and T.Client_Id = U.Users_Id)
    group by 1;


  • 0
    S

    Exactly! I cannot understand this part too.


  • 8
    C

    sorry, I described the question incorrectly. It should have been "Write a SQL query to find the cancellation rate of requests made by unbanned users".


  • 1
    K

    Hi, I think what the author tries to mean is that:
    (1) find out the requests made by unbanned clients ( because the trip is requested by client)
    (2) calculate the cancellation ratio (either by client or driver)


Log in to reply
 

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