If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > query to return random rows

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-30-04, 01:05
kar11 kar11 is offline
Registered User
 
Join Date: Jul 2004
Posts: 1
query to return random rows

I have a table with (questions and question ID's).. i want to write a query that will return a random set of questions from the database.
How can i do this..

thanks for your help...
Reply With Quote
  #2 (permalink)  
Old 07-30-04, 14:02
yellowmarker yellowmarker is offline
Registered User
 
Join Date: Jul 2004
Location: Dundee, Scotland
Posts: 107
the following mysql query would return 10 random questions form your database:

SELECT question_id, question_text FROM table_name ORDER BY rand() limit 0,10
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On