March 25, 2013

selectRandom rows from table

suppose we want a random records from table, we can use newID function of sql to get random records.




SELECT  top 5  AccountID  from AccountMaster
ORDER BY newid() DESC

After executing this query you will each time new random rows.

No comments:

Post a Comment