Select a Random Record from a Table
Another coding tip that will hopefully help someone
Ever found yourself having to pull out a random record from a table? The code below will do the trick for you:
T-SQL:
SELECT TOP 1 column
FROM table
ORDER BY NEWID()
MySQL:
SELECT column
FROM table
ORDER BY RAND()
LIMIT 1
Leave a Comment
Your Comment