Returning SQL Results in a random order

by Andrew Jackson 5. July 2006 12:33
Bit of an un-usual one but if you want to return a result set in a random order then you can use this;

SELECT *
FROM table
ORDER BY NEWID()

NEWID creates a unique value every time it's executed, the values are non-consecutive.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Development | SQL

Comments are closed

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen