EchoFool Posted April 29, 2008 Share Posted April 29, 2008 Is it possible to itegrate a rand into a query so it will find a random "row" with specified WHERE clause. Like an example would be ... pick 1 row at random out of all the rows that have Type = 3 and Check = 0. Can that be done in a query, or would you have to use a rand outside of the query? Link to comment https://forums.phpfreaks.com/topic/103342-rand-a-query-row/ Share on other sites More sharing options...
DarkWater Posted April 29, 2008 Share Posted April 29, 2008 SELECT * FROM table WHERE type=3 and check=0 ORDER BY RAND() LIMIT 1; There you go. Fill in the right table and stuff. Link to comment https://forums.phpfreaks.com/topic/103342-rand-a-query-row/#findComment-529248 Share on other sites More sharing options...
EchoFool Posted April 29, 2008 Author Share Posted April 29, 2008 Thankyou Link to comment https://forums.phpfreaks.com/topic/103342-rand-a-query-row/#findComment-529258 Share on other sites More sharing options...
DarkWater Posted April 29, 2008 Share Posted April 29, 2008 No problem. Link to comment https://forums.phpfreaks.com/topic/103342-rand-a-query-row/#findComment-529260 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.