lundi 23 mars 2015

Random rows from Database

I want to create a SELECT statement that gets 20% of the records from a table containing 50 records.


I managed to get 10 records in return, but I want the results to be random rows.


How can i solve this?


This is the query I have so far:



SELECT TOP 20 PERCENT * FROM que ORDER BY NEWID();




Aucun commentaire:

Enregistrer un commentaire