473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Pull up only recent dates from employees who have multiple records with multiple date

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?
May 8 '14 #1
8 1248
Seth Schrock
2,965 Expert 2GB
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.
May 8 '14 #2
i want to view it in a query
May 8 '14 #3
i have a query with fields of, first name, last name, work cell number, work cell type, is active and change form date. So when i run it all the dates from the change form date field come up, bt i only want to see the most recent date of each employee.
May 8 '14 #4
Seth Schrock
2,965 Expert 2GB
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.
May 8 '14 #5
Expand|Select|Wrap|Line Numbers
  1. SELECT Employee.FirstName, Employee.LastName, EmployeeInfo.WorkCellNumber, EmployeeInfo.WorkCellType, Employee.IsActive, EmployeeInfo.ChangeFormDate
  2. FROM Employee INNER JOIN EmployeeInfo ON Employee.EmployeeID = EmployeeInfo.EmployeeID;
May 8 '14 #6
Seth Schrock
2,965 Expert 2GB
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.
Expand|Select|Wrap|Line Numbers
  1. SELECT E.FirstName
  2. , E.LastName
  3. , EI.WorkCellNumber
  4. , EI.WorkCellType
  5. , E.IsActive
  6. , EI.ChangeFormDate
  7. FROM Employee As E INNER JOIN 
  8.     (
  9.         SELECT EmployeeID
  10.         , WorkCellNumber
  11.         , WorkCellType
  12.         , Max(ChangeFormDate)
  13.         FROM EmployeeInfo
  14.         GROUP BY EmployeeID
  15.     ) As EI
  16.     ON E.EmployeeID = EI.EmployeeID
May 9 '14 #7
There must be something im doing wrong, because it wont let me run it, it keeps sayin syntax error in JOIN operation.
May 9 '14 #8
Seth Schrock
2,965 Expert 2GB
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.
May 9 '14 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Don | last post by:
Hi: When I read my sqlxml results into a reader and deserialize it, I only get the first record deserialized into my object. If I have five records, they're all in the reader. But how do I get...
2
by: Adam | last post by:
Hi All, This may be a really obvious thing that I'm missing ... but if anyone can help, I'd appreciate it. I have MS Access 2000: I'm using it for a CRM type database. I have a table with...
1
by: Anderson | last post by:
Can you please help? I have an appointment table and employees have multiple records in this table simple because their contracts change. The table has fields change date and reason for change...
1
by: edhead | last post by:
Access newbie here, I am trying to figure out how to set up a query that will return an average from multiple records all created on the same date. Table has the following fields date, weight1,...
1
by: NumberCruncher | last post by:
Hi All, I am struggling with setting up my first system of tables, forms,and reports, and could use your help! I am setting up a database to keep track of the production of a produced item. The...
2
by: gafchic | last post by:
I manage a training database where I work and I would like to run a make table query. The table I want to query has a list of trainings our employees have taken and the dates they have taken the...
3
by: sgtsaltandpepper | last post by:
Hi, i am making a database to track the training courses that employees have to attend for my brothers company. There is one main table involved in what i am trying to do it is called...
0
chumlyumly
by: chumlyumly | last post by:
Hello scripters - OS: Mac OSX Language: PHP w/ MySQL database I've created an insert page where a user inputs his info, which then goes to four different tables in a MySQL database. The...
5
by: jrodcody | last post by:
Hello: I am trying to create multiple records in a table named tblTravel based on the input of a date range in two form controls. The inputs for the form are LastName, TravelDate, EndDate,...
8
by: cehlinger | last post by:
I am trying to add multiple records based on a date range. I found some examples and have tried them but am getting errors and I can't seem to figure out what the problem is. I am not a VBA...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.