21 September 2012

SQL SELECT RANDOM ROW

Select row secara random dengan MySQL:

SELECT column FROM table
ORDER BY RAND()
LIMIT 1

Select row secara random dengan SQL Server:

SELECT TOP 1 column FROM table
ORDER BY NEWID()

0 comments: