query DISTINCT
Code Example - query DISTINCT
SELECT DISTINCT Column_name FROM table_name;
how to use distinct in linq query in csharp
var distValues = objList.Select(o=>o.typeId).Distinct().ToList();
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();
}
csharp linq select only unique values from list
var uniq = allvalues.GroupBy(x => x.Id).Select(y=>y.First()).Distinct();
linq select distinct
var _dbLogList = (from d in _context.pu_Synchronize_Log
join cd in _context.pu_Synchronize_Child_Log
on d.Synchronize_Log_Id equals cd.Synchronize_Log_Id
where cd.Mobile_Device_Id == preference.DId && cd.Synchronize_Status == "OPEN"
&& !d.Is_Deleted && !cd.Is_Deleted
select new
{
d.Service_Name,
}).Distinct().ToList();