How could I simplify this solution?


  • 0
    Y
    select distinct * from 
    
    (select t.Request_at as Day, 
    
    Round((select count(*) from Trips where Client_Id not in (select Users_Id from Users where Role='client' and Banned='Yes') and Request_at=t.Request_at and Status<>'completed')/(select count(*) from Trips where Client_Id not in (select Users_Id from Users where Role='client' and Banned='Yes') and Request_at=t.Request_at), 2) as 'Cancellation Rate' 
    
    from Trips t 
    
    where t.Request_at='2013-10-01' or t.Request_at='2013-10-02' or t.Request_at='2013-10-03') 
    
    as T;
    

    It passed the tests and had a decent running time. However, it looks like the least elegant solution to me. Could someone please help me improve on it?


Log in to reply
 

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