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?
8 1248
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.
i want to view it in a query
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.
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.
- SELECT Employee.FirstName, Employee.LastName, EmployeeInfo.WorkCellNumber, EmployeeInfo.WorkCellType, Employee.IsActive, EmployeeInfo.ChangeFormDate
-
FROM Employee INNER JOIN EmployeeInfo ON Employee.EmployeeID = EmployeeInfo.EmployeeID;
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. - 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
There must be something im doing wrong, because it wont let me run it, it keeps sayin syntax error in JOIN operation.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
| |