Solution with CASE WHEN THEN


  • 0
    M

    Select Request_at As Day,FORMAT((COUNT(CASE WHEN t.Status <> "completed" THEN t.Id END) / COUNT(*)), 2) * 1 As Cancellation Rate
    From Trips t
    Left Join Users u On t.Client_Id = u.Users_Id
    Where u.Banned = 'No'
    And DATEDIFF(Request_at,'2013-10-01') >= 0
    And DATEDIFF('2013-10-03',Request_at) >= 0
    Group By Request_at


Log in to reply
 

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