在 LINQ 中使用 Max 函数
我正在尝试将此 sql 转换为我的 LINQ 查询,但遇到了很多问题。
select Heading,CreatedBy,ReleaseID, MAX(PublishDate)
from Releases
group by Heading,CreatedBy,ReleaseID
我需要以这种 LINQ 格式使用此查询
List<RelData> cmsPress = (from Release in dataContext.Releases
select new RelData
{
Heading = Release.Heading,
ReleaseID = Release.ReleaseID,
CreatedBy = Release.CreatedBy,
PublishDate = Release.PublishDate.ToShortDateString()
}).ToList();
I am trying to convert this sql into my LINQ query and am having alot of problems.
select Heading,CreatedBy,ReleaseID, MAX(PublishDate)
from Releases
group by Heading,CreatedBy,ReleaseID
I need to use this query in this LINQ format
List<RelData> cmsPress = (from Release in dataContext.Releases
select new RelData
{
Heading = Release.Heading,
ReleaseID = Release.ReleaseID,
CreatedBy = Release.CreatedBy,
PublishDate = Release.PublishDate.ToShortDateString()
}).ToList();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样的东西:
Something like this: