2011-06-24 12 views
1

これをLinqに変換するにはどうすればよいですか?SQLからLINQへの変換

SELECT 
     ps.forename,Count(ps.Forename) 

FROM 
     [Dbase].[dbo].[Absence] ab 
INNER JOIN 
     [Dbase].[dbo].[Person] ps 
On 
ab.empid=ps.id 
where ps.forename='hari' 
GROUP BY ps.forename 
Having Count(ps.forename)>2 

答えて

1

ここに行きます。

  var result = (from x in Absence 
        join y in Person on x.empid equals ps.id 
        group x by new { z = ps.forename == "hari" } into g 
        where g.Count() > 2 
        select new 
        { 
         g.Key, 
         cnt = g.Count() 
        });