Selecting Random Row from a SQL SELECT Statement
Friday, March 23, 2007
Well I just found something cool as I was looking for a way to select some data from a SQL Server table and only return 1 random row. Pretty easy too:
SELECT TOP 1 columnName FROM table ORDER BY NEWID()
Works like a charm.
Labels: Random, SELECT Statement, SQL