Hi folks, hope somebody can help...
I got a table, nights, in which 2 fields, shift1 and shift2, both correspond to an entry in another table, employees. Shift1 and shift2 contain an employeeID which is used to relate to an employee in the employees table.
Question is, how do I write an SQL query that returns both employees' names? I need to link the tables using a join (inner or left or whatever else...).
I can write a statement like:
Select nights.date, employees.name From nights Inner Join employees On nights.shift1=employees.ID Or nights.shift2=employees.ID
But that only gets me the name of the first employee
Any Idea, Anyone?
bourgui
I got a table, nights, in which 2 fields, shift1 and shift2, both correspond to an entry in another table, employees. Shift1 and shift2 contain an employeeID which is used to relate to an employee in the employees table.
Question is, how do I write an SQL query that returns both employees' names? I need to link the tables using a join (inner or left or whatever else...).
I can write a statement like:
Select nights.date, employees.name From nights Inner Join employees On nights.shift1=employees.ID Or nights.shift2=employees.ID
But that only gets me the name of the first employee
Any Idea, Anyone?
bourgui