fbarikzehy
fbarikzehy

Reputation: 5425

How to get top 10 record by its score field

I'm working on a project which there are shop's and customer's.customer's can score shop's.

my Score Data Table is like this:

Table Name is:ShopScores

enter image description here

I want to retrieve top 10 shops based on their Score field result.Is it possible to do that and if the answer is Yes, How can I do it?

By the way, I want to do that using LINQ Query.

Upvotes: 0

Views: 47

Answers (2)

user4039781
user4039781

Reputation:

SELECT * FROM `ShopScores` ORDER BY `score` DESC LIMIT 10

this gives the records ordered by score ,but this is for mysql This works perfectly fine

Upvotes: 0

Giorgi Nakeuri
Giorgi Nakeuri

Reputation: 35790

With linq:

var result = Context.ShopScores.OrderByDescending(c=>c.Score).Take(10);

Upvotes: 3

Related Questions