Appending only one record for each employee.

G

Guest

I have a table that is utilized for employee reviews. At the end of the year
I mark all approved reviews as complete. When the new year begins I want to
append the previous years standard data to a new table. Because an employee
can be reviewed many times during the year I want to make sure that I only
get one record, not a record for each time he was reviewed and secondly, that
I get the most current record. Each record is date stamped. Does anybody know
how to do this.
 
G

Guest

Try something along the lines of
INSERT INTO NewTable
SELECT * FROM OldTable AS T1
WHERE dateStampCol IN (SELECT Max(dateStampCol FROM OldTable WHERE
employeeId = T1.employeeId)

Hope This Helps
Gerald Stanley MCSD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top