What I'm trying to achieve is to return a random sample of x size from a dataset, then order it based on a column. This is what I have tried:
SELECT *
FROM Table
WHERE integerField > 0
ORDER BY RAND(), integerField DESC
LIMIT 100
The idea here is that it will first order the table by random, effectively shuffling it, then order the first 100 rows returned by the integerField. I believe the problem is that it does not do the limit before the order, so I'm either going to get 100 random lines back or the first 100 lines of the database ordered by score (In this example, it's the former)
Is there a way to achieve this in a single query, or will the output have to be manually parsed through external logic/additional queries?