SELECT ActionName,AVG(CASE WHEN pp.PageId=rr.GroupPageID AND GroupName='Profile' AND DisplayId='Action_View' THEN 1 ELSE 0 END) AS Rights
FROM (dbo.PagePermission pp LEFT JOIN dbo.AssignRightsToRole rr ON pp.PageId=rr.GroupPageID)
WHERE GroupName='Profile' AND DisplayId='Action_View'
GROUP BY ActionName
how to convert above query into linq???