Converting SQL Rank() to LINQ, or alternative(将 SQL Rank() 转换为 LINQ 或替代方法)
问题描述
我有以下 SQL 语句,可以按需要/预期工作.但是我想将它翻译成 LINQ 语句(Lambda??),以便它适合我的 DAL 的其余部分.但是我无法弄清楚如何在 LINQ 中模拟 Rank().
I have the below SQL statement that works as desired/expected. However I would like to translate it into a LINQ statement(Lambda??) so that it will fit with the rest of my DAL. However I cannot see to figure out how to simulate Rank() in LINQ.
我在这里发布它的原因(可能是错误的)是为了看看是否有人可以替代 Rank()
语句,以便我可以将其转换.或者,如果有一种在 LINQ 中表示 Rank()
的方法,那也将不胜感激.
The reason I posted it here, which is maybe in error, is to see if anyone has an alternative to the Rank()
statement so that I can get this switched over. Alternatively, if there is a way to represent Rank()
in LINQ that would be appreciated also.
推荐答案
下面的示例展示了我如何在 Linq 中模拟 Rank():
Here's a sample that shows how I would simulate Rank() in Linq:
输出
这篇关于将 SQL Rank() 转换为 LINQ 或替代方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!