Possible Duplicate:
DISTINCT() and ORDERBY issue
listOrders.DataSource = (from sp in dbdata.Specifications.Where(i => i.Approve == "Yes" && i.Awailable_BOM == "Yes")
join ord in dbdata.Orders on sp.O_id equals ord.O_id
join prd in dbdata.Products.Where(k => k.Hours_prd == null) on ord.O_id equals prd.O_ID
orderby ord.Special, sp.Due_date
select ord.O_id).Distinct();
I am tring to order by “ord.Special, sp.Due_date” but it doesn’t work after I put “Distinct();”. So how do I order by “ord.Special, sp.Due_date” and get distinct values.
I think this will return ordered ids:
Comments:
xgord.O_id) and group itemX, which will define order of id in result (in this caseFirstoccurrence of id will be returned)XKey(ord.O_id)