Select the top 3 record of each employee
Hi,
My question 'sounds' easy, but i can't think of a way to do this. Please help! NOTE: I am NOT asking to get only the top 3 records of the entire table, I am asking to get the top 3 record of [u]EACH</u> employee from the table.
Ok, i have an 'employee' history table with 200,000 records. Each employee could have multiple records with different 'effective' dates(please see below for an example of two employees' records). What I want to do is to run a query where it will pick up ONLY the top TWO records of [u]each emplyee</u>. How would I go about doing this?
Thank you.
Joe
Employee History Table:
SSN--------------------EFFV_Date
123-45-6789---------------01/02/2006
123-45-6789---------------12/03/2001
123-45-6789---------------08/22/2000
222-33-4444---------------05/28/2003
222-33-4444---------------07/01/1995
222-33-4444---------------06/30/1990
Query result should be somthing like this:
SSN-----------------------EFFV_date
123-45-6789---------------01/02/2006
123-45-6789---------------12/03/2001
222-33-4444---------------05/28/2003
222-33-4444---------------07/01/1995
|