Участник:Froyg/trips and users

Материал из DISCOPAL
Перейти к: навигация, поиск

https://leetcode.com/problems/trips-and-users/

 
SELECT Trips.Request_at DAY , ROUND( (SUM(CASE WHEN Trips.STATUS = 'completed' THEN 0 ELSE 1 END) / COUNT(*)), 2) 'Cancellation Rate'  FROM Trips JOIN Users ON Trips.Client_Id = Users.Users_Id AND Users.Banned = 'No'
WHERE Trips.Request_at BETWEEN '2013-10-01' AND '2013-10-03'
GROUP BY Trips.Request_at