Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT a.dep_month,
- a.dep_day_of_week,
- AVG(a.flight_distance) AS average_distance
- FROM (
- SELECT dep_month,
- dep_day_of_week,
- dep_date,
- SUM(distance) AS flight_distance
- FROM flights
- GROUP BY 1,2,3
- ) a
- GROUP BY 1,2
- ORDER BY 1,2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement