Getting random records from database table
Recently, in one project i need to get random records from sql server table and i found a good way to do same.
SELECT TOP <n> <column list>
FROM <table>
WHERE <criteria>
ORDER BY NEWID()
The main function is NEWID() which return GUID.
Ex. Select Top 10 * From Employees Order By NEWID()
Cheers !!
Krunal