I need to find the users that are on the same flight, the tables that hold the specific information are:
person(person_id, name, dob, address)
passenger (passenger_ID, person_ID)
ticket ( ticket_num(PK), passenger_id(FK), flight_num(FK) )
my approach is to self join ticket table to find the passenger id's that have the same flight number
select t.passenger_id
from tickets t join tickets ti on ti.ticket_num = t.ticket_num
where t.flight_num = ti.flight_num
Will this work??? any suggestions more than welcome! thanks!