- 이름과,여행 거리 출력하기 - 여행 거리 내림차순 정렬,이름 오름차순 정렬
SELECT u.name ,COALESCE(SUM(r.distance ),0) AS travelled_distance FROM Users AS u LEFT JOIN Rides AS r ON u.id=r.user_id GROUP BY u.id ORDER BY travelled_distance DESC,u.name