1
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?

Machavity
  • 28,730
  • 25
  • 78
  • 91
Pete
  • 53
  • 6
  • Possible duplicate of [Nested select statement in SQL Server](http://stackoverflow.com/questions/4629979/nested-select-statement-in-sql-server) – Aurora0001 Feb 26 '17 at 20:48

1 Answers1

3

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.

juergen d
  • 186,950
  • 30
  • 261
  • 325
  • 1
    *With this name you can refer to the result of the subquery and its columns.* Also without it. – shmosel Feb 26 '17 at 20:53