Why is my result set wrong?


#1

Non-Correlated Subqueries III

My sql statement appears to be returning the right result set but I'm not being allowed to go to the next exercise. I assume I'm doing something wrong. Any help would be appreciated. Thanks..!!



SELECT a.dep_month,
       a.dep_day_of_week,
       Round (AVG(a.flight_distance)) AS average_distance
  FROM (
        SELECT dep_month,
              dep_day_of_week,
               dep_date,
              AVG(distance) AS flight_distance
          FROM flights
         GROUP BY 1,2,3
       ) a
 GROUP BY 1,2
 ORDER BY 1,2;


#2

Please post a link to the exercise to we can see the instructions. Thanks,


#3

Here's the link.

Thanks,
Larry

https://www.codecademy.com/courses/sql-table-transformation/lessons/subqueries/exercises/non-correlated-iii?action=lesson_resume


#4

There is no need to round the average.

Just select distance, not avg(distance).


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.