Query fails to select the earliest time row. Duplicate issue
Hey guys
Hope you can help with something I have been struggling with for a couple of days.
It is about checking duplicate rows after inserted. I know you would say why not checking first before inserting, but we cannot do it for some reasons. We are using Oracle 12c.
When finding more than one same entries (transactionNumber and vendor as unique), the first entry with the earliest time should be passed as 'Success' Status and the other entries with the latest time should be rejected as 'Duplicate' status.
See the below pictures.
This first picture is expected. It happens most of the times in production.