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?
select DISTINCT T.Request_at,round(count(case when T.status<>'completed' then T.status else null end)/count(1),2)
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;
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".
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.