SELECT DISTINCT(name) FROM Pilots AS pilots JOIN ( SELECT *FROM Flights WHERE YEAR(flight_date) = 2023 AND MONTH(flight_date) = 8 and destination = "New York" ) AS flights ON pilots.pilot_id = flights.second_pilot_id;
https://sql-academy.org/ru/trainer/tasks/114