Like this:
from c in db.Company
group c by c.Name into grp
where grp.Count() > 1
select grp.Key
Or, using the method syntax:
Company
.GroupBy(c => c.Name)
.Where(grp => grp.Count() > 1)
.Select(grp => grp.Key);
More Related Contents:
- SQL query for finding records where count > 1
- C# LINQ find duplicates in List
- What are the benefits of a Deferred Execution in LINQ?
- LINQ with groupby and count
- LINQ Partition List into Lists of 8 members [duplicate]
- LINQ Between Operator
- LINQ OrderBy versus ThenBy
- LINQ: combining join and group by
- What’s the difference between IQueryable and IEnumerable [duplicate]
- Can LINQ be used in PowerShell?
- Linq order by, group by and order by each group?
- Use LINQ to concatenate multiple rows into single row (CSV property)
- Linq-to-entities – Include() method not loading
- PowerShell equivalent of LINQ Any()?
- Instantiating a context in LINQ to Entities
- conditional include in linq to entities?
- LINQ not updating on .SubmitChanges()
- Linq To Entities – how to filter on child entities
- Expose IQueryable Over WCF Service
- The specified type member ‘Date’ is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties
- Entity Framework, Code First and Full Text Search
- Conditional SQL count
- Simple Linq query has duplicated join against same table?
- LINQ Include vs Join. Are they equivalent?
- Tradeoffs using NHibernate 3.0 QueryOver or LINQ provider
- If condition in LINQ Where clause
- Point connectionstring in dbml to app.config
- Building Dynamic LINQ Queries based on Combobox Value
- Count number of records returned by group by
- NHibernate vs LINQ to SQL