lundi 25 avril 2016

ORDER BY RAND() for multiple columns (shuffle content of each column vertically)

I'm looking for a mysql solution to have several columns output a random field from that column.

The query I have now only selects the entire row randomly but does not randomize the separated columns.

$sql = "SELECT col1, col2, col3, col4 FROM table ORDER BY RAND() limit 4";

I tried subqueries but I'm not familiar with that so if anyone could help ...




Aucun commentaire:

Enregistrer un commentaire