I have a table with columns like this
Std_id Class Section
14 8 2
14 8 1
14 9 1
15 8 3
15 8 2
15 8 1
Now I want student max class and max section by unique Student ID Like this
Std_id Class Section
14 9 1
15 8 3
I tried following queries with no success
SELECT std_id, class, section FROM `session` GROUP BY std_id ORDER BY std_id ASC,class DESC,section DESC
And
SELECT DISTINCT student_id, class_id, section_id FROM `student_session` ORDER BY student_id ASC,class_id DESC,section_id DESC