Filter DataTable to show only the most recent transaction for each user
- by Dan Neely
I have a datatable that contains rows of transaction data for multiple users. Each row includes UserID and UserTransactionID columns. What would I use for as a RowFilter in the tables DefaultView to only show the row for each user that has the highest UserTransactionID value?
sample data and results
UserID UserTransactionID PassesFilter
1 1 False
1 2 False
1 3 True
2 1 True
3 1 False
3 2 True
My data is orginating in a non-SQL source, the DataTable is being created to be bound to a DataGridView so I can't make changes to a query being used to get the data initially.