Group By Having Count > 1 in Linq -
this question has answer here:
- linq group having count 2 answers
i have following data
date | projecttypeid -------------- ------------- 10/31/2016 | 1 11/30/2016 | 2 12/31/2016 | 2 01/01/2016 | 3
what linq query dates projecttypeids has dates count > 1
results should yield me following list of dates because projecttypeid = 2 has 2 dates associated it
11/30/2016 12/31/2016
something like:
var result = data.groupby(item => item.projecttypeid, item => item.date) .where(group => group.count() > 1) .selectmany(group => group) .tolist();
Comments
Post a Comment