Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
LINQ 中是否有 SQL Server PARTITION OVER 功能的等效项?
SELECT Decision_ID , ID ROW_NUMBER() OVER ( PARTITION BY Decision_ID ORDER BY Decision_ID, ID ASC ) calcAmend FROM dbo.Decision_Data
它给出了每条记录的排名
DecisionData .GroupBy(d => d.DecisionID, (key, dd) => dd .OrderBy(d => d.Id) .Select((d, i) => new {d.DecisionId, d.Id, calcAmend = i})) .SelectMany(d => d)