首页 新闻 搜索 专区 学院

sql转linq

0
悬赏园豆:30 [已关闭问题] 关闭于 2021-09-24 11:24

我有个视图,v_ep_alarm_log 有(BeginTime、EndTime、AreaId[区域])等字段,我需要统计 最近7天各区域报警数量变化,请问下面的sql脚本如果转换成linq或Lamda?我转了几次运行都报错,提示无法翻译linq/lamda语句

SELECT CONVERT(VARCHAR(10), BeginTime, 120) AS DayDate ,
COUNT(CASE WHEN ( AreaID = 'FS' ) THEN 1
END) AS Fs4Count ,
COUNT(CASE WHEN ( AreaID = 'FSV' ) THEN 1
END) AS Fs5Count ,
COUNT(CASE WHEN ( AreaID = 'CA' ) THEN 1
END) AS CpCount ,
COUNT(CASE WHEN ( AreaID = 'Gygc' ) THEN 1
END) AS GCount
FROM dbo.v_ep_alarm_log
WHERE BeginTime >= '2021-07-01 00:00:00'
AND BeginTime < '2021-07-08 00:00'
GROUP BY CONVERT(VARCHAR(10), BeginTime, 120)
ORDER BY DayDate;

Assur的主页 Assur | 初学一级 | 园豆:14
提问于:2021-09-24 11:23
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册