You need subqueries:
(SELECT * FROM makale WHERE category = 'Histoire' LIMIT 12)
UNION ALL
(SELECT * FROM makale WHERE category = 'Cultures' LIMIT 12)
UNION ALL
(SELECT * FROM makale WHERE category = 'Sujet Divers' LIMIT 12)
ORDER BY id DESC;
You can also write this using window functions, but that is not your question.
Note: This returns an arbitrary 12 rows for each category. I’m leaving the code as is, because this answers the question you have asked. But if you want a particular set of 12 rows, then you should use an ORDER BY
in each subquery.
CLICK HERE to find out more related problems solutions.