Tuesday, March 06, 2007
Selecting random records from a database table
A little nugget I picked up from my colleague Wim today, that was actually his first blog post a few years back.
Need a random sample of data from your database? Try this:
SELECT TOP 10 * FROM Orders ORDER BY NEWID()
Need a random sample of data from your database? Try this:
SELECT TOP 10 * FROM Orders ORDER BY NEWID()