gpt4 book ai didi

.net - 如何将 SQL 查询转换为 LINQ?

转载 作者:行者123 更新时间:2023-12-04 06:05:21 25 4
gpt4 key购买 nike

我是 LINQ 的新手。谁能帮我将以下 SQL 查询转换为 LINQ?

SELECT 
Date,ShiftName,Max(Score) AS Score, 1 AS IsPreferred
FROM
Temp_Nurse_Fill_RequestNumbers
group by
ShiftName,date

最佳答案

from t in Temp_Nurse_Fill_RequestNumbers 
group by t.ShiftName, t.date
into g
select new
{
Date = g.date,
Score = (from tt in g select tt.Score).max
IsPreferred = 1
};

关于.net - 如何将 SQL 查询转换为 LINQ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8426208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com