Randomly selecting a row from a database
Database
2
Posts
2
Posters
0
Views
1
Watching
-
Does anyone have a good piece of SQL that will randomly select 1 row from a database? I was thinking of doing a sqequence something like this Count the number of rows Generate a random number (rn) between 1 and the result of the count Select Top (1) From (Select Top (rn) Order by ID DESC) Is there a better way? Thanks Stephen.
-
Does anyone have a good piece of SQL that will randomly select 1 row from a database? I was thinking of doing a sqequence something like this Count the number of rows Generate a random number (rn) between 1 and the result of the count Select Top (1) From (Select Top (rn) Order by ID DESC) Is there a better way? Thanks Stephen.