I know there are a lot of ways to select random records or rows from a database table, but in this quick article I will show you the Microsoft SQL Server and MySQL syntax required to accomplish the end goal.
Microsoft SQL Server:
SELECT TOP 25 ColumnName FROM TableName
ORDER BY NEWID()
MySQL:
SELECT ColumnName FROM TableName
ORDER BY RAND()
LIMIT 25
If you like this post and want to see more, follow me on my website www.chadcompton.com
No comments:
Post a Comment
Drop me a line.