Hoping one of the SQL coders out there can help us. We are trying to report on process level transfers and needing to create a select statement to pull the employee's current & prior process level from the HRHISTORY table. We would also like to use this similar code to pull dept number and job code. We are using the following SQL select to pull the most recent process level change:
SELECT A.*
FROM HRHISTORY AS A
LEFT OUTER JOIN HRHISTORY AS B ON B.EMPLOYEE = A.EMPLOYEE
AND B.FLD_NBR = 14 AND B.FLD_NBR = A.FLD_NBR AND
B.BEG_DATE > A.BEG_DATE
WHERE B.BEG_DATE IS NULL AND A.FLD_NBR = 14;
Would anyone be willing to share their SQL code for obtaining the prior process level record from HRHISTORY? Does not have to be specific to process level field number, just need to know how to obtain a prior value from history.
Thank you in advance!
Deanna