SQL: Table Transformation 4. Non-correlated subqueris III

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
Exercise LINK:
https://www.codecademy.com/es/courses/sql-table-transformation/lessons/subqueries/exercises/non-correlated-iii?action=resume

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
Error CODE: “Use the select statement to view the table”
“Error: near line 2: no such column: a.flight_distance”

```

SELECT * FROM flights;
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(*) AS
flight_count
FROM flights
GROUP BY 1,2,3
) a
GROUP BY 1,2
ORDER BY 1,2;

<do not remove the three backticks above>
Thanks

@andresgardiol,
Maybe you should have a look at the tables and column-names
using
+++ show all table defintions
select * from sqlite_master;