Is there a way to return result with its order?
Sample: Run the following query on the quiz
table:
select q.category_id, q.quiz_id, concat('Quiz ',q.name) name
from quiz q
where q.category_id = 11
order by q.category_id ASC
limit 2
offset 2;
Table quiz
(structure):
+-------------+---------+-------+
| category_id | quiz_id | name |
+-------------+---------+-------+
| 10 | 10 | math |
| 11 | 10 | sport | => Quiz Sport 1
| 11 | 11 | sport | => Quiz Sport 2
| 12 | 10 | Geo. |
| 11 | 15 | sport | => Quiz Sport 3
| 11 | 12 | sport | => Quiz Sport 4
| 10 | 17 | math |
| 11 | 20 | sport | => Quiz Sport 5
| 11 | 22 | sport | => Quiz Sport 6
| 10 | 19 | math |
+-------------+---------+-------+
returns:
+-------------+---------+------------+
| category_id | quiz_id | name |
+-------------+---------+------------+
| 11 | 15 | Quiz sport |
| 11 | 12 | Quiz sport |
+-------------+---------+------------+
http://sqlfiddle.com/#!9/110752/2
Is there a way to return a result with the Quiz number order, like this:
+-------------+---------+--------------+
| category_id | quiz_id | name |
+-------------+---------+--------------+
| 11 | 15 | Quiz sport 3 |
| 11 | 12 | Quiz sport 4 |
+-------------+---------+--------------+