The task is to find the record closest to ConfirmationStarted among all the Closed records before ConfirmationStarted in each ID.
In SQL, this problem can be solved using multi-level subqueries and window functions to generate sequence numbers and filter records.
In SPL (Structured Process Language), which provides natural sequence numbers and rich position-related calculations, this problem can be solved more efficiently.