MS SQL Server:
SELECT TOP 1 Field1, ..., FieldN
FROM Table1
ORDER BY NEWID()
Do not use:
SELECT TOP 1 Field1, ..., FieldN
FROM Table1
ORDER BY RAND()
MS Access:
SELECT TOP 1 Field1 , ..., FieldN
FROM Table1
ORDER BY Rnd(Field1)
Reference:
http://www.carlj.ca/2007/12/16/selecting-random-records-with-sql/
check this link : http://webgeek.elletis.com
ReplyDelete