i have an employee database,my employees have multiple change forms with diff dates, but i only want to find the most recent date from each employee. How do i do that?
Pull up only recent dates from employees who have multiple records with multiple date
Collapse
X
-
Welcome to Bytes.
Depends on how you are wanting to view the information. In a query? In a textbox? We need more information to be able to properly help you. -
Can you post the query's SQL code (See Before Posting (VBA or SQL) Code). If your data is properly normalized, then it will be very simple to do. If not (then it should be) we will have to do a little trick to get it to work. Your SQL code will tell me which method is needed.Comment
-
Code:SELECT Employee.FirstName, Employee.LastName, EmployeeInfo.WorkCellNumber, EmployeeInfo.WorkCellType, Employee.IsActive, EmployeeInfo.ChangeFormDate FROM Employee INNER JOIN EmployeeInfo ON Employee.EmployeeID = EmployeeInfo.EmployeeID;
Last edited by Rabbit; May 8 '14, 10:20 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.Comment
-
Wonderful. Okay, this is just air code as I don't have a system up to be able to test it, but this should be close if not perfect.
Code:SELECT E.FirstName , E.LastName , EI.WorkCellNumber , EI.WorkCellType , E.IsActive , EI.ChangeFormDate FROM Employee As E INNER JOIN ( SELECT EmployeeID , WorkCellNumber , WorkCellType , Max(ChangeFormDate) FROM EmployeeInfo GROUP BY EmployeeID ) As EI ON E.EmployeeID = EI.EmployeeID
Comment
-
Please post what you have using the [CODE/] button to add the required code tags for you.
You might try running just the subquery on it own. Just copy the code between the parenthesis into a new query window and then try to run it and see if there is an error.Comment
Comment