Results 1 to 5 of 5
Sep 9, 2009, 10:38 #1
- Join Date
- Jan 2004
- Leighton, Iowa
- 0 Post(s)
- 0 Thread(s)
Multiple table Join and show missing data
I have spent about two hours testing various SQL calls to pull data from three tables and check for missing data.
Here are my three tables:
fields: f_name, l_name, year, a_id (primary Key), photo, gender, active
fields: id (primary key), a_id (foreign key athletes table), s_id (foreign key schedule table), time, place, dnr
fields, s_id (primary key), location, time, date
I want to be able to pull all athletes who have yet to have a results for a given scheduled event.
I can pull athletes that have entries for the event easily enough but I need the opposite.
The following pulls all the athletes and registers any that have an entry in results:
SELECT * FROM (athlete LEFT JOIN results ON athlete.a_id = results.a_id ) LEFT JOIN schedule ON results.m_id = schedule.s_id