Skip to content

Instantly share code, notes, and snippets.

@levelboy
Created November 5, 2015 00:54
Show Gist options
  • Save levelboy/38041ed7c338cf496443 to your computer and use it in GitHub Desktop.
Save levelboy/38041ed7c338cf496443 to your computer and use it in GitHub Desktop.
select IdStudent, avg(Grade) as grade_sum into @best_student_id, @best_average from Grade group by IdStudent order by grade_sum desc limit 1;
select * from StudentData where Id = @best_student_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment