0

Name City ID

C Houston 12
A London 36
B Houston 25
A London 40

Output:

A London 36
A London 40

I have a DataTable and want to return all duplicate rows (only based on Name and City columns) Any help?

Thanks!

Helen
  • 255
  • 2
  • 3
  • 8

1 Answers1

2

You can run the LINQ statement below

var l = (from r in table
         group r by new { a.Name, a.City } into g
         where g.Count() > 1
         select g).SelectMany(g => g).ToList();
Maxim Balaganskiy
  • 1,524
  • 13
  • 25