img

Hey men I'm battling to produce a query which provides schedule of the pilot for any given day. To date I have got

SELECT f.flight_date, l.lesson_date FROM Flight f JOIN lesson l ON f.pilot_idpilot = l.pilot_idpilot WHERE f.flight_date = CURDATE() OR l.lesson_date = CURDATE() AND pilot_idpilot = 7236;

The end result I recieve is

Lesson_id | lesson_date | pilot_idpilot | idFlight | flight_date | pilot_id_pilot

It is possible to way simply to specify the kind of activity the pilot is involved with e.g.

Activity | Date |

Any help could be awesome! thanks men/women

What about this:

SELECT 'Lesson' as Activity, lesson_date as Date
FROM Flight f JOIN lesson l ON f.pilot_idpilot = l.pilot_idpilot 
WHERE l.lesson_date = CURDATE() AND pilot_idpilot = 7236
UNION
SELECT 'Flight' as Activity, flight_date as Date
FROM Flight 
WHERE f.flight_date = CURDATE() AND pilot_idpilot = 7236;