Selecting one row by random, where a column is set
| From: | Mathias Hunskår Furevik | Date: | Sat, 20 Mar 2004 01:24:48 +0000 |
| Subject: | Selecting one row by random, where a column is set | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-33567@lists.php.net to get a copy of this message | ||
Using MySQL.
I've got the SQL line: $sql = "SELECT * FROM shop_items ORDER BY RAND() LIMIT 1";
I've got a column which is called image_large. The tricky part is, not all of the image_large rows exists. Whis the query above, I want to get only a row where image_large is present.
-
Mathias Furevik
Norway