Switch to full style
Include SQL commands
Post a reply

selecting a record randomly from table

Tue Jul 17, 2012 10:30 pm

For randomly selecting a record from database using RAND function , to get a one record randomly you can run the following query :

Code:

SELECT 
FROM Department where  type='active' ORDER BY RAND() limit 1


You can also select more records:

Code:

SELECT 
FROM Department where  type='active' ORDER BY RAND() limit 10




Post a reply
  Related Posts  to : selecting a record randomly from table
 Randomly generated rows and columns in Array     -  
 error in inserting record     -  
 Timeout error while updating record in SQLServer in ASP.NET     -  
 Selecting a Database in php     -  
 Selecting a Domain Name at the Time of Registration     -  
 Draw Bezier Curve and selecting the points with mouse click     -  
 Using table in latex     -  
 table creation     -  
 row highlight of table     -  
 table row hover     -