0

Please could somebody assist me in an example of the following SQL into a LINQ query in C#, I am using .NET 4.0.

       SELECT x.*
          FROM [eBookAddict].[dbo].[UrlRecord] x
          JOIN (SELECT t.Slug
                  FROM [eBookAddict].[dbo].[UrlRecord] t
              GROUP BY t.Slug
                HAVING COUNT(t.Slug) = 2) y ON y.Slug = x.Slug

Many Thanks,

Paul

4

1 回答 1

2
from x in db.UrlRecord

join y in db.UrlRecord.GroupBy(rec => rec.Slug).Where(grp => grp.Count == 2)
on y.Key equals x.Slug

select x;
于 2013-05-24T09:06:18.970 回答