15 years on The Web
miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | 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 Top

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

 Short link for this topic:

You are welcome to post anonymously, by entering a nickname with no password (if the similar Username has not been taken yet), or by leaving both fields empty. If you have a forums account, you can also sign in from this page without posting a message, or sign in and post at once.

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 ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB