나는 C 번호는/LINQ는 다음과 같은 요구 사항을 충족하기 위해 사용하여 쿼리를 디자인에 약간의 도움을 찾고 :, 중복 기록을 감지 만 먼저 선택하고 카운팅 LINQ/C#
나는 회사의 목록을 가지고있다 -
Id Name Email Address
1 Company A [email protected] abc
2 Company B [email protected] abc
3 Company C [email protected] abc
4 Company D [email protected] abc
5 Company A [email protected] abc
내 목표는이 예 '이름'과 '이메일'에서, 두 개의 필드를 기반으로 중복 항목을 감지하는 것입니다.
- 중복 고객 만 유사한 레코드의 양을 도시한다 한번
- 표시 shuold :
원하는 출력은 아래와 같이 고객의 목록이다.
원하는 중복 목록 : - 당신이 명시 적으로 중복의 각 세트에 최저 ID 기록을 사용하려면
Id Qty Name Email Address
1 2 Company A [email protected] abc (Id/details of first)
2 1 Company B [email protected] abc
3 1 Company C [email protected] abc
4 1 Company D [email protected] abc
출력 ID가 이상합니다. 회사 A의 올바른 ID는 무엇입니까? –
http://stackoverflow.com/questions/1606679/remove-duplicates-in-the-list-using-linq –
@RohitVyas 이러한 솔루션은 중복 레코드를 제거하지만 각각의 경우 중복 레코드 수는 계산하지 않습니다. –