-
1407. Top Travellers mysqlLeetCode_Study_Plan/SQL 2022. 10. 3. 18:53
https://leetcode.com/problems/top-travellers/?envType=study-plan&id=sql-i
select u.name, IFNULL(tb.travelled_distance, 0) as travelled_distance from (select user_id, sum(distance) as travelled_distance from rides group by user_id) tb right join users u on tb.user_id = u.id order by tb.travelled_distance desc, u.name asc;
'LeetCode_Study_Plan > SQL' 카테고리의 다른 글
1158. Market Analysis I mysql (0) 2022.10.03 1393. Capital Gain/Loss mysql (0) 2022.10.03 1741. Find Total Time Spent by Each Employee mysql (0) 2022.10.02 1890. The Latest Login in 2020 mysql (0) 2022.10.02 511. Game Play Analysis I mysql (0) 2022.10.02