First of all, I could not find appopriate name for the question, if anyone can find a better name, I would be grateful if they edit. I am new at SQL, and I have the following question: I have two tables as stated below
Member -> Name, UID (PK), SupervisorUID. WorkPlace -> WP_UID (PK), Name, SupervisorUID.
I need to create a query that returns Name of the member as well as their supervisors name that work in WorkPlace 'X'.
I am trying to use inner join but I am not able to achieve what i am trying to. The main question is, how can I select by WorkPlace name, and obtain both members name and supervisor's name.
Supervisor is also a member, so, WorkPlace.SupervisorUID should match with Member.UID
SELECT Member.Name, Y
INNER JOIN WorkPlace on WorkPlace.SupervisorUID = Member.UID
WHERE WorkPlace.Name = 'France'
I need to find what to put on Y.
I need to find how can I get supervisors name from taking uid from workplace, then going member table, find uid that matches with that supervisor uid and get the name.
Member
Jeremy 123 421
Jack 421 421
WorkPlace
1 France 421
I want to return the following table,
Jeremy Jack