Suppose I have a table with following data:
gameId difficultyLevel numberOfQuestions
--------------------------------------------
1 1 2
1 2 2
1 3 1
In this example the game is configured for 5 questions, but I’m looking for a SQL statement that will work for n number of questions.
What I need is a SQL statement that given a question, displayOrder will return the current difficulty level of question. For example – given a displayOrder of 3, with the table data above, will return 2.
Can anyone advise how the query should look like?
things might be easier for you if you change your design as duffymo suggests, but if you must do it that way, here’s a query that should do the trick.