I am tying to pull the max EFFECT_DATE frm the PRSAGDTL table in Crystal and cannot find a formula or command that will do this. Does anyone have any ideas or has had an issue with this that can help me out. I would appeciate any and all help.
Thanks
Maria
I'm assuming you are joining from EMPLOYEE to PRSAGDTL, and want to report the most recent step-and-grade pay rate for the employee? Off the top of my head, I can think of two ways to do this in Crystal: 1) Using a sub report, and passing from the employee to the subreport the schedule, grade and step. In the subreport, select for the passed schedule, grade and step. Then suppress the details and use 'insert group' on one of those fields, and summarizes based on max() of the effective date. Put the fields into the group footer. 2) You can also do something similar without the sub report, using insert group for employee, schedule, grade, and step. suppress the details, as well as the group header/footer for schedule and grade. Insert a summary for effective date, putting the maximum into the group footer for step. Then, use the 'Group Sort Expert' to create a 'TOP N', where N = 1 based on the max of the effective date. What this will do is only show the latest effective date for each schedule/grade/step.
SELECT SCHEDULE, PAY_GRADE, PAY_STEP, PAY_RATE, EFFECT_DATE FROM ( SELECT SCHEDULE, PAY_GRADE, PAY_STEP, PAY_RATE, EFFECT_DATE, ROW_NUMBER() OVER (PARTITION BY SCHEDULE, PAY_GRADE, PAY_STEP ORDER BY EFFECT_DATE DESC) AS RowCnt FROM PRSAGDTL WHERE EFFECT_DATE<=GETDATE() ) S WHERE RowCnt =1