how to select distinct with linq code example
Example 1: select count of distinct values sql
SELECT COUNT (DISTINCT column-name) FROM table-name
Example 2: select distinct linq mvc
public static IQueryable<ProdType> GetDistinctProdType(
this IQueryable<ProdInfo> query,
int categoryId)
{
return (from p in query
where p.CatID == categoryId
select p.Type).Distinct();
}