I have two tables, equipment and users. In the equipment table I have two field, owner and technician which both link to the users table id.
I can get the owner's name using a single join, but not sure how to get the technician's name
SELECT *, name, email FROM equipment
LEFT JOIN users ON equipment.owner = users.id
I've tried to use aliases but have had no success.
Need to see the tables' detaisl
, owner.name AS owner_name
, owner.email AS owner_email
, technician.name AS technician_name
, technician.email AS technician_email
JOIN users AS owner
ON owner.id = equipment.owner
JOIN users AS technician
ON technician.id = equipment.technician