Selecting one row by random, where a column is set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux