Using a subquery, find the average total distance flown by day of week and month.
Be sure to alias the outer query as average_distance and the inner query as flight_distance.
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, distance as flight_distance from flihgts group by 1,2,3 ) a group by 1,2 order by 1,2;
Can anyone tell me what's wrong with my query? Thank you so much!