How to select a group of random rows?
I'm trying to figure out how to pull a select number of random rows from a table but I also want to include rows which have a specfic value in one column as well.
I know this is how you pull 10 random rows.
SELECT * FROM table ORDER BY RAND() LIMIT 10
Lets say out of 100 rows 2 of them have the column "flag" set to "1" where the other 98 are set to "0".
Is there a way to randomly select 10 rows from that table but to always include in that select the 2 rows which have their "flag" set to 1.
Thanks in advance!