Hi
I have two tables Employee and Job, Employee's prmary key is EID and in Job there is a EID that is a foreign key to Job. job has another column as the status of the employee.

first the employee is added to the database and then the job detils are added to the database

how do i get a query for all the employee who that the EmpStatus == 'Active' and the employees that the job details are not updated to the database

apprecite a reply
thanks

Recommended Answers

All 3 Replies

Try this out:

SELECT
    e.EID
FROM
    Employee AS e
WHERE
    e.EmpStatus = 'Active' AND
    e.EID NOT IN (SELECT DISTINCT j.EID FROM Job AS j )

the emplyee status is in the job table

sry

I don't understand, if the EmpStatus is on the Job table, what do you mean by job details not updated?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.