To make a big sql structure simple: I am having next structure:
id level answercorrect points
1 1 0 0
2 1 1 60
3 1 1 80
4 1 1 77
5 1 1 92
6 1 0 0
7 2 0 0
8 2 0 0
9 2 0 0
10 2 1 80
11 2 0 0
12 2 0 0
I now want to display two things:
1) how many levels were completed (this is min. half of the questions correct)
2) the level where you scored the most points.
Now I can go and manually do a query for each level, then compare them and then output them.
SELECT (*) FROM QUESTIONS WHERE LEVEL = level AND ANSWERCORRECT = 1
But Is there a way to do this quicker? It just seems like a to big bunch of code to accomplish that on my way..?
This will show you each level, with a count of answers, and a count of correct answers.
Or
It seems superfluous to store points and correctness, if points = 0 implies incorrect and points>0 implies correct?