LINQ to SQL select distinct from multiple colums

Posted by Morron on Stack Overflow See other posts from Stack Overflow or by Morron
Published on 2010-04-02T16:48:35Z Indexed on 2010/04/02 16:53 UTC
Read the original article Hit count: 529

Filed under:
|
|

Hi,

I'm using LINQ to SQL to select some columns from one table. I want to get rid of the duplicate result also.

Dim customer = (From cus In db.Customers Select cus.CustomerId, cus.CustomerName).Distinct

Result:

  • 1 David
  • 2 James
  • 1 David
  • 3 Smith
  • 2 James
  • 5 Joe

Wanted result:

  • 1 David
  • 2 James
  • 3 Smith
  • 5 Joe

Can anyone show me how to get the wanted result? Thanks.

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about linq-to-sql