I've been searching for a solution to this but not managed to find it. We have a table listing person ID, application ID and application date. One person may have submitted multiple applications. Basically I am trying to generate a list that displays the previous application date (if any) for the person submitting the application - i.e. the date of any application that preceded the current one for that person. So the date is always relative to the current application date.
The new table would show person ID, application ID, application date, previous application date as set out in the following example. Note dates expressed DD/MM/YY
Original data:
Person | Applic ID | Applic Date |
---|---|---|
Fred | 100 | 1/1/22 |
Steve | 101 | 2/2/22 |
Dave | 104 | 17/2/22 |
Fred | 105 | 24/2/22 |
Steve | 107 | 24/2/22 |
Fred | 108 | 25/2/22 |
Procedure Returns:
Person | Applic ID | Applic Date | Prev Applic Date |
---|---|---|---|
Fred | 100 | 1/1/22 | - |
Steve | 101 | 2/2/22 | - |
Dave | 104 | 17/2/22 | - |
Fred | 105 | 24/2/22 | 1/1/22 |
Steve | 107 | 24/2/22 | 2/2/22 |
Fred | 108 | 25/2/22 | 24/2/22 |
I have tried several solutions but most were simplified ie get the 2nd highest date for a chosen field (say person ID); in this case there is another step - we need the highest date that is lower than the existing date for the person ID involved in an application; I couldn't find anything that solved this