I need to create a correlated sub query which shows the Employee ID, Employee_First_Name and the employees who have 2 or more tasks. But Ive got into a muddle and don't know how to write it correctly. The employee_id is in the employee table and task table, allowing them to join.
So far I've done this:
SELECT E.EMPLOYEE_ID, E.FIRST_NAME
FROM EMPLOYEE E
WHERE TASK.EMPLOYEE_ID IN (SELECT COUNT(TASK.EMPLOYEE_ID) FROM TASK)
HAVING COUNT (TASK.EMPLOYEE_ID) >=2;
SELECT E.EMPLOYEE_ID, E.FIRST_NAME
FROM EMPLOYEE E
INNER JOIN (
SELECT EMPLOYEE_ID
FROM TASK
GROUP BY EMPLOYEE_ID
HAVING COUNT(*) >= 2
) AS T ON T.EMPLOYEE_ID = E.EMPLOYEE_ID
--ORDER BY E.ID