I have a datatable the has duplicate lines. I need to get the duplicates and compare the duplicate lines for the best value in certain columns.
DataTable dt = new DataTable();
dt.Rows.Add(1, "Test1", "584", 12);
dt.Rows.Add(2, "Test2", "32", 123);
dt.Rows.Add(3, "Test3", "425", 54);
dt.Rows.Add(4, "Test1", "4", 755);
dt.Rows.Add(5, "Test5", "854", 879);
dt.Rows.Add(6, "Test2", "1", null);
dt.Rows.Add(7, "Test2", "999", 3);
Notice Test 1 and 2 have duplicates.
(1, "Test1", "584", 12)
(4, "Test1", "4", 755)
(2, "Test2", "32", 123)
(6, "Test2", "1", null)
(7, "Test2", "999", 3)
Now that I have the duplicates. I need to make one line that has the best values. New datatable should show:
Test1 = "Test1", "584", 755
Test2 = "Test2", "999", 123
Test3 = "Test3", "425", 54
Test5 = "Test5", "854", 879