Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Retrieving next to last row in a recordset Expand / Collapse
Author
Message
Posted Tuesday, January 04, 2005 2:47 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, July 27, 2006 8:43 PM
Points: 2, Visits: 1

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.

 




Post #153595
Posted Tuesday, January 04, 2005 3:01 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, September 16, 2010 9:01 AM
Points: 148, Visits: 132

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.




Post #153598
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse