m0_37543773
m0_37543773
采纳率0%
2017-11-20 02:57 阅读 905

各位大牛,请教一下。这条sql语句用linq怎么写啊

10

select a.MouthsId as 月份,
SUM(case when [years]='2017' and g.Code='19191919' and g.GprsType=1 then b.WaterConsumption else 0 end),
SUM(case when [years]='2017' and g.Code='19191919' and g.GprsType=2 then b.WaterConsumption else 0 end)
from Mouth as a left JOIN [MeterRecordHistory]
as b on a.MouthsId=b.mouths
left JoIn Meter as m on m.id=b.MeterId
left JoIn Hub as h on h.Id=m.HubId
left JoIn Gprs as g on g.Id=h.GprsId
group by a.MouthsId order by a.MouthsId

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

相关推荐