20201215 | A | New | 1 |
20201216 | A | Terminated | 2 |
20201215 | B | New | 1 |
20201216 | C | New | 1 |
20201216 | D | New | 1 |
20201216 | D | Update | 2 |
Solved! Go to Solution.
Hi @yunpeng
From your data, it looks like we can use the "version" to sort the data set and take the latest record by trade id. However, I still sorted the data by date descending and version descending and then took the first record by trade ID. This way we would get the latest record for trade ID and then simply apply the filter as per our need.
If you have millions of records in database, it would be easier to do the same in DB. You can use Rank window function in database and take the first rank only.