Reputation: 27
I am currently trying to bump up an application export against our enterprise HR listing to identify any current employees in the application that have been terminated (that will come from HR).
Table 1 - Application Listing. Contains Emp_name and Emp_ID
Table 2 - HR Listing. Contains Emp_name, Emp_ID, Termination_Date (important).
Do you know what code I need to end up with a column added into Table 1 with each employee's respective termination date? If NULL, they are still employed, if there's a date populated, that is our observation.
Upvotes: 0
Views: 46
Reputation: 1355
It should be this simple, unless there are other conditions you haven't discussed.
SELECT table1.*, table2.Termation_Date --list out columns instead of *
FROM table1
INNER JOIN table2
ON table1.Emp_ID = table2_EmpID
WHERE table2.termination_Date IS NOT NULL
Upvotes: 1