My Answer for Question_BY_MySQL


  • 0
    X

    My Answer for Trips and Users

    select tmp.Request_at day , round(sum(if( tmp.status <> 'completed' , 1 , 0)) / count(*) , 2) AS 'Cancellation Rate' from (
    select t.status , t.Request_at
    from trips t join users u on t.client_id = u.users_id
    where t.request_at between str_to_date('2013-10-01' , '%Y-%m-%d') and str_to_date('2013-10-03' , '%Y-%m-%d')
    and u.Banned = 'No') tmp
    group by day
    order by day


Log in to reply
 

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