1
2
3
4
5
6
|
# Write your MySQL query statement below
select u.name, IFNULL(sum(r.distance), 0) as travelled_distance
from Users u
left join Rides r on u.id=r.user_id
group by r.user_id
order by 2 desc, 1 asc
|
cs |
반응형
'SQL' 카테고리의 다른 글
leetcode 1965. Employees With Missing Information (0) | 2022.03.31 |
---|---|
leetcode 1179. Reformat Department Table (0) | 2022.03.31 |
leetcode 1890. The Latest Login in 2020 (0) | 2022.03.30 |
leetcode 1484. Group Sold Products By The Date (0) | 2022.03.30 |
leetcode 1581. Customer Who Visited but Did Not Make Any Transactions (0) | 2022.03.30 |
댓글