Appending only one record for each employee.

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
Back
Top