行程和用戶
SELECT t.`request_at` AS `Day`, ROUND(SUM(IF(t.status = 'completed', 0, 1))/COUNT(t.status) ,2) AS `Cancellation Rate` FROM Trips AS t LEFT JOIN Users u1 ON u1.users_id = t.client_id LEFT JOIN Users u2 ON u2.users_id = t.driver_id WHERE u1.banned = 'No' AND u2.banned = 'No' AND t.`request_at` BETWEEN '2013-10-01' AND '2013-10-03' GROUP BY t.`request_at`
SELECT t.`request_at` AS `Day`, ROUND(SUM(IF(t.status = 'completed', 0, 1))/COUNT(t.status) ,2) AS `Cancellation Rate` FROM Trips AS t JOIN Users u1 ON u1.users_id = t.client_id AND u1.banned = 'No' JOIN Users u2 ON u2.users_id = t.driver_id AND u2.banned = 'No' WHERE t.`request_at` BETWEEN '2013-10-01' AND '2013-10-03' GROUP BY t.`request_at`
===
标签:Users,No,用戶,u1,request,u2,262,id,leetcode From: https://www.cnblogs.com/carlzhang19/p/17347160.html