↧
Answer by DBeck for Rank rows using weighted average with multiple sub queries
Here is the solution to the problem:SELECT * FROM ( SELECT student_id, avg, exam,(exam) + (avg) as total, (@rn := @rn + 1) AS rank FROM (SELECT student_id, ( SELECT AVG(g.grade) / 100 * 40 FROM grades...
View ArticleAnswer by dnoeth for Rank rows using weighted average with multiple sub queries
The query you posted is actually running without syntax errors?You need an average over a CASE like this:SELECT * FROM ( SELECT student_id, avg, exam,(exam) + (avg) as total, (@rn := @rn + 1) AS rank...
View ArticleRank rows using weighted average with multiple sub queries
So what I want to do, is to rank students based on their weighted average which will be calculated by separating the grades based on the type (whether "exam" or "not exam). The average for both will...
View Article