Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linq to sql 需要从SQL查询制定Linq查询的帮助吗_Linq To Sql - Fatal编程技术网

Linq to sql 需要从SQL查询制定Linq查询的帮助吗

Linq to sql 需要从SQL查询制定Linq查询的帮助吗,linq-to-sql,Linq To Sql,我需要帮助从上述SQL查询创建Linq。请帮忙。谢谢 SELECT (count(Competency_Id) * 100 /(Select count(Competency_Id) from [dbo].[QLs])) as Percentage ,[dbo].[Competencies].Name as CompetencyName FROM [dbo].[QLs] INNER JOIN [dbo].[Competencies] ON [dbo].[QLs

我需要帮助从上述SQL查询创建Linq。请帮忙。谢谢

 SELECT (count(Competency_Id) * 100 /(Select count(Competency_Id) from [dbo].[QLs])) 
          as Percentage ,[dbo].[Competencies].Name as CompetencyName
 FROM [dbo].[QLs]
 INNER JOIN [dbo].[Competencies]
    ON [dbo].[QLs].Competency_Id= [dbo].[Competencies].Id
 GROUP BY dbo.[QLs].Competency_Id,dbo.[Competencies].Name
        var query = (from u in db.QLs
                    join c in db.Competencies on u.Competency_Id equals c.Id
                    let total = db.QLs.Count()
                    group u by new
                    {
                        Competency_Id = u.Competency_Id,
                        Name = c.Name,
                        total = total
                    } into g
                     select new QLbyCompetencyPieChart
                    {
                         Percentage = (float)(100 * g.Count()) / ((float)g.Key.total),
                        Competency= g.Key.Name, 
                        Color=null
                    }).AsQueryable();