Today, when writing the project, this problem occurred, after Baidu and help people to help the end of the original LAMDBA is to remove the duplicates of var Total1 = db. Nikedtcdailyreport.where (p = p.cn_launch_date >= date1 && p.cn_launch_date <= date2). Where (p = p.cn_planning_qty! = 0). ToList ();
var total2= total1.where ((x, i) = Total1.findindex (p = = P.style = x.style) = = i). Count ();
the second type isvar SDLDelivered1 = db. Nikedtcdailyreport.where (p = p.cn_launch_date >= date1 && p.cn_launch_date <= date2
&& P.cn_planning_qty! = 0 && P.lw_specs_review = = NULL && P.sample_batch = = NULL && P.revi Ew_request_to_category = = NULL && P.review_back_from_category = = NULL
). Where (p = = P.cn_cn_copy_status__y_n_ = = "Y"). Select (P=>p.style). ToList ();
var SDLDelivered2 = sdldelivered1.distinct (). Count (); Most people are aware of the turn-to-set trial distinct to remove the repetition of the third clock var CategoryReviewwing1 = db. Nikedtcdailyreport.where (p = p.cn_launch_date >= date1 && p.cn_launch_date <= date2)
. Where (p = p.cn_planning_qty! = 0 && P.review_request_to_category! = null &&
P.review_back_from_category = = NULL
). AsEnumerable (). ToList ();
var CategoryReviewwing2 = categoryreviewwing1.groupby (o = = new {O.style}). ToList (). Exists (g = G.count () > 1);
var CategoryReviewwing2 = categoryreviewwing1.groupby (o = = new {O.style}). Where (g = G.count () >= 1). ToList ();
var CategoryReviewwing2 = categoryreviewwing1.groupby (o = = new {O.style}). Where (g = G.count () >= 1). Count ();
It notes how much of the duplicate data the query has, and the second one is to the list collection, and the third is converted to the int type.
Three ways to remove duplicates from EF+LAMDBA