Jump to content

select multiple rows with highest value


BrainPill

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 comment
Share on other sites

  • 4 months later...

Hello,@BrainPill

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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...