I have 3 primary keys. CompanyName, EmpNo, StartDate.
I want to create a stored procedure that can allow me to update only the second to last record of each empno. How can I achieve that? In this case I have to records per empnno but I want to update only the second to last record regardless of the amount of record ex; If I have 100 records I want to update the 99th record of the same empno.
CompanyNo EmpNo StartDate FinalDate
1 1 1999/01/01 2013/04/26
1 1 2013/04/17 9999/12/31
1 2 1999/01/0 2013/04/26
1 2 2013/04/17 9999/12/31
1 3 1999/01/01 2013/04/26
1 3 2013/04/17 9999/12/31
In this case I want to edit only the second to last in FinalDate. these ones;
CompanyNo EmpNo StartDate FinalDate
1 1 1999/01/01 2013/04/26 <--- this finaldate field
1 2 1999/01/01 2013/04/26 <--- this finaldate field
1 3 1999/01/01 2013/04/26 <--- this finaldate field