I am just starting to code in C# and need some direction with achieving the SQL Rank over partition within C# ( LINQ)
I have retrieved the following data from the database and have stored the SQL result in a data table within c#. the column 'Score' would have to be multiplied with a coefficient within the code and hence I cant perform a SQL Rank. I need to rank the SKU s within the partition [ID1, ID2] by descending order of score. The SQL Equivalent is :
Select ID1,ID2,SKU, Rank () over ( partition by ID1,ID2 order by score desc) as [Rank]
The result set
Once I have the rankings, I finally need to obtain the ranking distribution of a specific SKU (say s1) and the corresponding revenue distribution across the entire result.
Select SKU,
Rank,
count(*)
sum (revenue)
from prev_result
SKU RANK OCCURENCE REVENUE
s1 1 2 400
s1 2 xx yy
Any help will be greatly beneficial.