how to write this sql in efcore?

mc 3,601 Reputation points
select rank() over(partition by e.Id, e.CreateTime order by  e.score desc) id from ScoreInfo  

how to write it in ef core?

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
694 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jack J Jun 24,276 Reputation points Microsoft Vendor

    @mc , Welcome to Microsoft Q&A, based on my test you could try the following code example to achieve the same function with the sql query you mentioned.


    We need to use GroupBy and SelectMany method to do it.



    Hope this could help you.

    Best Regards,

    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments