Good day! I use this query:
SELECT f.id FROM articles f
JOIN ( SELECT RAND() * (SELECT MAX(id) FROM articles) AS max_id ) AS m
WHERE f.id >= m.max_id
ORDER BY f.id ASC
LIMIT 5
The problem is that It returns the unexpected amount of the rows. It can be 1 row or 3 rows or 5 rows. But I need exactly 5 rows. Is there any way to fix it?
Aucun commentaire:
Enregistrer un commentaire