I have a DB with two tables:
Here is an example of this DB.
Using MYSQL, I'd like to execute a SELECT query able to show the names of both employees involved in each turn shift.
The following picture shows the desired query results using the previous db example:
It can be done as follow:
t.ID AS turnShiftID,
t.date AS turnShiftDate,
e1.name AS employee1Name,
e2.name AS employee2Name
INNER JOIN employees e1 ON t.ID_employee1 = e1.ID
INNER JOIN employees e2 ON t.ID_employee2 = e2.ID;