Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

converting dens_rank and row_number to linq

var result = data.GroupBy(item => new { item.OriginalDocumentNumber, item.FilterRound })
    .OrderBy(@group => @group.First().p2_FinalGrade)
    .AsEnumerable()
    .Select((@group, groupIndex) => new
    {
        Items = @group.Select((item, index) => new { Item = item, Index = ++index }),
        Rank = ++groupIndex
    })
    .SelectMany(v => v.Items, (s, i) => new
    {
        Data = i.Item,
        RankInGroup = i.Index,
        DenseRank = s.Rank
    }).ToList();

result.Where(item => item.Data.p2_FinalGrade == "d" ||
                        item.Data.p2_FinalGrade == "f")
      .Where(item => item.Data.OriginalDocumentNumber == "590200054")....
Comment

PREVIOUS NEXT
Code Example
Csharp :: command parameter wpf 
Csharp :: nuget package TSETMC guide 
Csharp :: Go Statement in CSharp 
Csharp :: O thread de chamada não pode aceder a este objecto porque existe outro thread que já o tem 
Csharp :: populate array from an XML file 
Csharp :: Code snipet for jump script unity 2d 
Csharp :: how to hide cell in epplus 
Csharp :: Null check operator used on a null value 
Csharp :: user (current login user) in viewcomponent 
Csharp :: ef6 export update 
Csharp :: Camera follow player script unity 
Csharp :: c# datagridview select row index programmatically 
Csharp :: tune off exit button wpf 
Csharp :: Bitwise Left Shift C# 
Csharp :: hash sign c sharp 
Csharp :: mailkit send email c# 
Csharp :: get number of sundays in a month c# 
Csharp :: c# add field to expando object 
Csharp :: list to array f# 
Csharp :: Return out of a Ienumerator/Courotine in C# 
Csharp :: imageLocation in C# 
Csharp :: .net new template 
Csharp :: skrivetækning 
Csharp :: c# message box carriage return 
Csharp :: c# user and password verification 
Csharp :: show a message box in c# 
Csharp :: hardcode dropdown cshtml 
Csharp :: cluster size C: powerschell 
Csharp :: C# walk down a tree and back 
Csharp :: Diplay player final score in new scene in unity 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =