I have a table that contains many records for one topic.
For instance:
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.
Can you show some of the sp? That would help.
That way you can get some help on how to pass the logic: select max(effective_date) where emply_status='A' to it. I think that's what you're after.