c# - Distinct not working in nested select in linq -
(from sn1 in uow.systemnotifications join sn2 in ( sn2 in uow.systemnotifications select new { sn2.userid, sn2.notificationtypeid, sn2.itemid } ).distinct() on new { sn1.userid, sn1.notificationtypeid } equals new { sn2.userid, sn2.notificationtypeid } select sn1).tolist();
when execute query, distinct() not working. selects records in result of inner query. how modify distinct rows in inner query result.
you can use group this, folowing code helps solve problem,
var rootcategories2 = (from p in sr.products group p.subcategory p.category subcats select subcats);
let me know if u have problem.
Comments
Post a Comment