Student Subj Period Score
-------------------------
A Math 100 50
A Hist 100 100
A Sci 200 70
B Math 100 50
B Hist 100 50
I’m trying to query for the highest score for an each student.
If scores are all same (such as ‘B’ then pick one on the bottom. If that’s not possible, just pick anything.
I’m having a hard time using max() and min() and group by to get a correct result.
Result should look like this
Student Subj Period Score
-------------------------
A Hist 100 100
B Hist 100 50
You want to use analytic functions (I assume this is in Oracle from the mention of pl/sql):