文章目录
-
- 原题题目
- 代码实现(首刷自解)
原题题目
代码实现(首刷自解)
# Write your MySQL query statement below
SELECT name,IFNULL(SUM(distance),0) AS travelled_distance
FROM users AS u LEFT JOIN rides AS r ON u.id = r.user_id
GROUP BY user_id
ORDER BY travelled_distance DESC,name