Question

How can I write this query from SQL to LINQ:

SELECT * FROM table
WHERE np in 
(
    SELECT np FROM table
    GROUP BY np 
    HAVING COUNT(np) > 1
Was it helpful?

Solution

Something like this:

<Table>.GroupBy(x => x.np)
       .Where(x => x.Count() > 1)
       .SelectMany(x => x)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top