Joining two tables with specific columns



    SELECT employees.EmpName, employees.Address AS employeer address, 
           supervisor.Name, supervisor.Address AS supervisor address,supervisor.project 
    FROM tbEmployees 
       AS employees 
    JOIN tbSupervisor 
       AS supervisor 
    ON 
       employees.ID = supervisor.SupervisorID




You can use the table name as part of the column specification:

SELECT tbEmployees.EmpName, tbEmployeesAddress, tbSupervisor.Name,
       tbSupervisor.Address, tbSupervisor.project

FROM tbEmployees

JOIN tbSupervisor

ON tbEmployees.ID = tbSupervisor.SupervisorID

This is what you need:

Select e.EmpName, e.Address, s.Name, S.Address, s.Project
From tbEmployees e
JOIN tbSupervisor s on e.id = SupervisorID

You can read about this on W3Schools for more info.


You can get columns from specific tables, either by their full name or using an alias:

SELECT E.EmpName, E.Address, S.Name, S.Address, S.Project
FROM tbEmployees E
INNER JOIN tbSupervisor S ON E.ID = S.SupervisorID