I know I’m making this more complicated that necessary, but I can not figure out the solution!
How do I iterate through a data table to delete duplicate names from a data table and keeping the newest record? About 50 rows of data.
Example
John Taylor 07/14/2019
John Taylor 08/ 12/2019
Result
John Taylor 08/12/2019
The list isn’t huge and there could be more than a couple duplicates for the same name.
This process is data scraping from a web site, doing some filtering to keep only the columns I need, and I have it sort the table so that the duplicate names are grouped together.
@James_Taylor
Sort the datatable on date and then get unique keys using default view property,
Datatable.DefaultView().ToTable(<Boolean Value to remove duplicate", “”)
In your case,
dtTable.DefaultView().ToTable(true, “Name”)
where the parameters in ToTable denote -
true => remove duplicate
“Name” => reference column name to remove duplicates.