Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Linq difficulties getting single column distinct values

$
0
0

Table Profile holds several columns, I am only interested in the distinct values of the column regIp

Linq below gives me all columns.

How can I narrow this down to just a list of distinct regIp?

var holdIPs = dbContext.Profile
    .GroupBy(i => new { i.regIp })
    .Select(i => i.FirstOrDefault()).ToList();


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>