SELECT * FROM (SELECT * FROM my_table ORDER by row_id DESC LIMIT 8) t ORDER BY RAND()
I saw this in an answer, What does the 't' mean before ORDER BY?
Subqueries need an alias name. In this case it is t
.
With this name you can refer to the result of the subquery and its columns.