How to find select distinct Address in Entity Framework

Total Post:26

Points:182
 1241  View(s)
Ratings:
Rate this:
Hi All,

I want to access all distinct 'Address'  in Employee Table. My code is below:

SELECT DISTINCT Address FROM Employee

But i am not get correct output .Can any one give me a solution.

Thank you.

  1. Post:135

    Points:949
    Re: How to find select distinct name in Entity Framework

    Hi Simond,


    you try this:

                   var res = (from Add in context.Employee 
                                                select Add .Address).Distinct();
    It will returns  IEnumerable<string>. you can convert List<string> by adding  .ToList().

      Modified On Apr-11-2018 02:18:42 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!