note 15667 modified in ref.mysql by philip
| From: | philip@php.net | Date: | Tue, 16 Jul 2002 15:58:38 +0000 |
| Subject: | note 15667 modified in ref.mysql by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-33140@lists.php.net to get a copy of this message | ||
Hi, here's a nice little trick to select records in random order from a table in a MySQL
database prior to version 3.23
SELECT *, (ItemID/ItemID)*RAND() AS MyRandom FROM Items ORDER BY MyRandom
[[[Editors note:
And just SELECT * FROM foo WHERE bar = RAND() after 3.23
]]]
--was--
Hi, here's a nice little trick to select records in random order from a table in a MySQL
database prior to version 3.23
SELECT *, (ItemID/ItemID)*RAND() AS MyRandom FROM Items ORDER BY MyRandom
http://www.php.net/manual/en/ref.mysql.php