如何将以下SQL查询转换为Linq?

时间:2016-01-21 07:39:52

标签: sql sql-server linq sql-server-2008

如何将以下SQL查询转换为Linq?

   create procedure sp_summary(date datetime)
    as 
     Begin
      Declare @v1 varchar(10)
      .....
      .....
      exec sp_sub_1
      exec sp_sub_2
      ....
      exec sp_sub_10
      ....
      ....
    End

请帮助我,谢谢

1 个答案:

答案 0 :(得分:0)

var result = ServiceCalls
        .Where(s => s.Ser_CallDate.Month == DateTime.Now.Month
            && s.Ser_CallDate.Year == DateTime.Now.Year)
        .GroupBy(s => s.Ser_CallDate)
        .Select(g => new {
                OrderDate = g.Key,
                TotalCall = g.Count()})
        .ToList();