FIND THE ANSWERS

SQL: How do I select the 10 highest values that have a unique index?

Answer this question

  • SQL: How do I select the 10 highest values that have a unique index?


Answers

Answer #1 | 26/12 2013 15:32
I'm not at my work computer and don't have access to the SQL management studio right now so my answer may not be syntactically correct but try this. SELECT TOP 10 id, memberid, score FROM tri_results ORDER BY memberid DESC I am not exactly positive of what you are asking for but I think the TOP keyword will somehow work into the final solution.
Positive: 50 %
Answer #2 | 27/12 2013 14:55
It looks like your score doesn't apply to the memberid correctly. You are grouping by memberid, but then you are ordering by a score that applies supposedly to the group. But, since we can't actually see the tables, I'm not sure. This may be one of those occasions you need a DISTINCT in there. There is just not enough info. You might even have to use HAVING.
Positive: 50 %

Possible answer