1. Select top 1 * from 'table_name' order by NEWID()
Above query return 1 row on the random basic.. row might be repeat .
2. Select top 1 * from 'table_name' where Id=(select (RAND()*Count(Id)) from 'table_name')
Above query return 1 row from total rows present in table on random basic .. row might be repeat .
note : Id is the Column name and Id must be in sequence and unique
3. Select top 1 * from 'table_name' where Id=(select Floor(RAND()*Count(Id)) from 'table_name')
Frequency of repeat row might be less
Above query return 1 row on the random basic.. row might be repeat .
2. Select top 1 * from 'table_name' where Id=(select (RAND()*Count(Id)) from 'table_name')
Above query return 1 row from total rows present in table on random basic .. row might be repeat .
note : Id is the Column name and Id must be in sequence and unique
3. Select top 1 * from 'table_name' where Id=(select Floor(RAND()*Count(Id)) from 'table_name')
Frequency of repeat row might be less
No comments:
Post a Comment