Jump to content

select multiple rows with highest value

Recommended Posts

I have a query it goes like this:

SELECT `person_id` , MAX(exam_score) FROM `results` GROUP BY `exam_score` 

exam_score is column and some values are double

when using query above I get 1 result for each.

So if the exam_score is 10,  8, 9 , 10, 8, 5, 3 10 , 6 it does:

10, 9, 8 , 6, 5, 3

while I would want:

10,10,10, 9, 8, 8




Edited by BrainPill
Link to post
Share on other sites
  • 4 months later...


Please try this query, To select multiple rows with highest value :

select * from updates where 1 group by matching having votes=max(votes) order by matching asc;

I hope above query will be useful for you.

Thank you.



Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...