miniBB Support Forums | 16 years on The Web
miniBB ® 


 | Begin | Register | Reply | Search | Statistics | File Bank | Manual |
Specific miniBB Support Forums / Specific /   

Select random rows in $Tt

Author tkx211
#1 | Posted: 28 Oct 2011 16:28 | Edited by: tkx211 
I want to make a list of 10 random rows in $Tt. Because some old topics maybe interested for somebody, example in a poem/ story forum, But I don't know how to query MySql. I don't want to run 10 queries at once. Can you help me? Thank you very much.

Author Paul
Lead Developer
#2 | Posted: 28 Oct 2011 17:55 
I think, you don't have to run 10 queries, but just make a "random" order.

select * from {$Tt} order by rand() limit 10;

is probably about what you need...

Author tkx211
#3 | Posted: 28 Oct 2011 18:52 
But can 'order by rand()' take several seconds? Because it sort all rows then choose only 10 rows

Author Guest
#4 | Posted: 28 Oct 2011 19:13 

Specific miniBB Support Forums / Specific /
 Select random rows in $Tt
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message

Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.

Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.


miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.