I have problems in joining several queries with different data limits depending on the subject, having the query raised as follows:
$sql = "SELECT * FROM quiz WHERE materia = 'matematico' LIMIT 40
UNION
SELECT * FROM quiz WHERE materia = 'Lenguaje' LIMIT 30
UNION
SELECT * FROM quiz WHERE materia = 'Ciencias' LIMIT 30
UNION
SELECT * FROM quiz WHERE materia = 'Historia' LIMIT 30
UNION
SELECT * FROM quiz WHERE materia = 'Quimica' LIMIT 30";
The problem is that it only shows me a single result, when in each subject there are 500 questions.
In order to apply
LIMIT
individually to each query, you must wrap each query in parentheses, example:You can review the documentation here: https://dev.mysql.com/doc/refman/8.0/en/union.html