I have a table that contains many records for one topic.
Employee PTO_Accr Employ status Effective Date
123456 .91 T 01/31/2005
123456 .91 A 08/01/2004
123456 .91 A 06/15/2004
123456 .80 A 01/15/2002
My stored procedure needs to look at the last effective dated record, however, if the employee is terminated I need to capture the next to last record (in this case, 08/01/2004). I can not use a prior in the same script as a fetch next. Any suggestions would be greatly appreciated. Thank you.