Afternoon all,
I have 2 tables I'm working with here, 'Employees' contains all the employee details & 'Notes' contains a list of dates and notes.
I'm trying to get a list of all employees thats havent had any notes in the last 3 weeks with the latest date & latest note, the query below essentially works but I'm sure there is a better way. Could someone give me some advice as to the best way to approach this problem please.
Thanks
SELECT Emp_Name, MAX( CAST(Notes_DateTime AS DATE)) As Notes_DateTime, Emp_Status, Emp_Area
FROM Employees
INNER JOIN Notes ON Emp_ID = Notes_EmpID
WHERE Notes_DateTime < dateadd(WEEK,-3,GETDATE())
GROUP BY Emp_Name, Emp_Status, Emp_Area