HOW TO FIND SELECT DISTINCT ADDRESS IN ENTITY FRAMEWORK

Simond Gear

Total Post:26

Points:182
Posted by  Simond Gear
 933  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. Anupam Mishra

    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 Mar-19-2016 12:26:43 AM

Answer

NEWSLETTER

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