Convert this SQL statement to LINQ-to-SQL

Posted by goforebroke on Stack Overflow See other posts from Stack Overflow or by goforebroke
Published on 2010-05-26T23:40:24Z Indexed on 2010/05/27 1:01 UTC
Read the original article Hit count: 194

Filed under:

I have struggled converting this SQL statement to LINQ to SQL VB.Net 9.0. I have used Linqer but no success. Any help would be appreciated

select t.TeeId,
   t.DescriptionId,
   t.[Description],
   t.Rating,
   t.Slope,
   case when d.TotalHoles <> h.TotalHoles then 0
   else 1 end [Status]
from dbo.CourseDescription d
inner join dbo.CourseTees t
on t.DescriptionId = d.DescriptionId
inner join (select TeeId, count(*) as TotalHoles
           from dbo.CourseHoles
          group by TeeId) h
on h.TeeId = t.TeeId
where d.CourseId = 1

© Stack Overflow or respective owner

Related posts about linq-to-sql