I try to display a random row of each group with SQL and PHP. A group is a "category" in my database.
I use this:
SELECT *
FROM images i, set s
WHERE i.ImageSetId = s.SetId
GROUP BY s.SetCategorie
ORDER BY rand()
With this code, I've got one row for each category but it always return the first row and I don't understand how to display a random row for each categorie. Can someone help me, please ?
ps: I've tried other things with date, and GROUP BY rand('e.SetCategorie') but it's don't work at all.
Thanks in advance and excuse my english :p
Aucun commentaire:
Enregistrer un commentaire