I need to find the points to make division (student results). It works fine but it selects only 7 the best scores to be appear on the table of results. I have two problems:
- What can I do so that all scores to appear but only seven the best scores to be taken to make division?
This query is for a single student, how can I do to get results of the whole class?
SELECT sum(( case when((test+exam)/2)>=75 then 1 when ((test+exam)/2)>=65 then 2 when ((test+exam)/2)>=45 then 3 when ((test+exam)/2)>=30 then 4 when ((test+exam)/2)<30 then 5 END)) as points FROM (SELECT test,exam FROM results u WHERE regno='$regno' and term='$term' and form='$form' and year='$year' ORDER BY ((test+exam)/2) DESC LIMIT 0,7)k;