I don’t understand why the “a” is there and what the ‘a’ does and what the ‘a’ means.
AVG(a.flight_distance) AS average_distance
sum(distance) AS flight_distance
GROUP BY 1,2,3
GROUP BY 1,2
ORDER BY 1,2;
If you do GROUP BY 1, 2: It will sort like it does above except it’s also going to create extra entries for each unique entry in dep_day_of_week. This means you will now have multiple entries for each unique dep_month as long as it has more than one dep_day_of_week (basically, no longer making it unique to itself) since we’re also including each unique entry of dep_day_of_the_week (results explanation below the data):