Pada Database MySQL :
SELECT * FROM nama_tabel ORDER BY RAND() LIMIT jml_diinginkan
misal :
SELECT * FROM pertanyaan ORDER BY RAND() LIMIT 10
Pada Database SQL Server :
SELECT TOP jml_diinginkan * FROM nama_tabel ORDER BY newid()
misalnya :
SELECT TOP 10 * FROM pertanyaan ORDER BY newid() SELECT TOP 10 percent * FROM pertanyaan ORDER BY newid()
Pada Database MS Access :
SELECT TOP jml_diinginkan * FROM nama_tabel ORDER BY rnd(id_tabel)
contoh :
SELECT TOP 10 * FROM pertanyaan ORDER BY rnd(id_pertanyaan)
Semoga berguna ^_^
Tidak ada komentar:
Posting Komentar