I can't figure out how to do this after reading multiple posts on the internet and I would just like to make a very clear post below about this problem.
I will remove the post if I am pointed to a article with the same question that helps me.
I have an example data table below. I would like to remove duplicate rows but only where the "Request Type" is "Cancel Order" and the "Order Numbers" are the same.
Report Date Time, Order Number, Request Type, Old Value, New Value
12/5/2019 12:00 , TM123456-01 , Cancel Order, 470000000, 5700000000
12/5/2019 12:00 , TM123456-01 , Cancel Order , 123000000, 4560000000
12/5/2019 12:00 , MT123456-02 , Add Order , 470000000, 5700000000
12/5/2019 12:00 , AP123456-02 , Add Order , 470000000, 5700000000
12/5/2019 12:00 , ST123456-02 , Remove Order , 470000000, 5700000000
So the row that should be removed from the above data table should be row 2 because it has the same "Order Number" as row 1 which is "TM123456-01" and it's request type was "Cancel Order".
The result I would like to be left with would be the data table below.
Report Date Time, Order Number, Request Type, Old Value, New Value
12/5/2019 12:00 , TM123456-01 , Cancel Order, 470000000, 5700000000
12/5/2019 12:00 , MT123456-02 , Add Order , 470000000, 5700000000
12/5/2019 12:00 , AP123456-02 , Add Order , 470000000, 5700000000
12/5/2019 12:00 , ST123456-02 , Remove Order , 470000000, 5700000000
I know that I could probably do this with a nested For Each loop but I would like to learn how to do this in a more elegant way with Microsoft LINQ, if possible, or another method.