Working but not sure why this is rated hard?

  • 0
    SELECT Request_at AS Day, 
    ROUND((SUM(CASE WHEN Status LIKE 'cancelled%' THEN 1 ELSE 0 END) / COUNT(*)),2) AS 'Cancellation Rate'
    FROM Trips T
    WHERE EXISTS (SELECT 1 FROM Users where Banned = 'No' AND Users_Id = T.Client_Id) AND (Request_at >= '2013-10-01' AND Request_at <= '2013-10-03')
    GROUP BY Day
    ORDER BY Day

    Works but oscillates between 125ms and 280ms I think perhaps the testing regime is a bit faulty.

Log in to reply

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