Jump to content
Sign in to follow this  

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

Share this post

Link to post
Share on other sites

If you want to query multiple databases and group the results into a single result set, you need to use unions or subqueries to get the various results into a single set.

Share this post

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.

Sign in to follow this  

  • Create New...