Solution for Trips and Users with join


  • 0
    E
    select 
      request_at as Day, 
      round(
          sum(if(t.status <> 'completed', 1, 0)) / 
          count(*)
        , 2) as 'Cancellation Rate'
    from trips t
    join users u on 
      u.users_id = t.client_id 
    where (request_at between '2013-10-01' and '2013-10-03')  and u.banned <> 'Yes'  
    group by request_at
    

Log in to reply
 

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