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, count(distance) as flight_distance from flights group by 1,2,3 ) a group by 1,2 order by 1,2
I have to find the average total distance flown by day of week and month .Cn anyone tell me the error in my code?
Hint: It's not count(distance) because you're not counting the number of distance, your calculating the total sum of all the distance
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.