Posted By

blackf0rk on 03/12/09


Tagged

sql random


Versions (?)

Randomize Query in SQL


 / Published in: SQL
 

URL: http://codefinds.blogspot.com/2008/08/randomize-query-in-sql.html

Sometimes you want to return a bunch of data from a table, but you want it coming back in a random order. Maybe it's for keeping some content on a home page fresh. Here's how:

  1. SELECT TOP 10 * FROM [someTable] ORDER BY NEWID()

Report this snippet  

You need to login to post a comment.