Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Experties,
How to find out latest record with latest status.please see the below example table :
ID | StartDate | Days | StatusReason | ||
A1001 | 01/01/2017 10:08:11 | 10 | closed | ||
A1001 | 01/01/2017 11:08:11 | 15 | Pending | latest record | |
A1001 | 31/01/2017 10:08:11 | 30 | closed | ||
A1002 | 01/02/2017 12:10:13 | 12 | Pending | ||
A1002 | 21/02/2017 12:10:13 | 15 | closed | Latest Record |
i would like to expecting like below
ID | StartDate | Days | StatusReason |
A1001 | 01/01/2017 11:08:11 | 15 | Pending |
A1002 | 21/02/2017 12:10:13 | 15 | - |
It would be helpfull if anyone can provide the logic.
Regards,
Sunny
ID | Maxstring(StartDate) | FirstSortedValue(Days, -StartDate) | FirstSortedValue(StatusReason, -StartDate) |
---|---|---|---|
A1001 | 31.01.2017 10:08:11 | 30 | closed |
A1002 | 21.02.2017 12:10:13 | 15 | closed |