Es la alternativa UNION
sintaxis con un ORDER BY
final .
Así es como se ve una unión de este tipo entre dos selecciones:
(SELECT ...)
UNION
(SELECT ...) ORDER BY ... LIMIT ...
Y esto es lo que tal unión entre one seleccionar se parece a:
(SELECT ...) ORDER BY ... LIMIT ...
No relacionado con las subconsultas en absoluto.
Esto no está documentado en MySQL, pero es obvio a partir de the gramática :
top_level_select_init:
SELECT_SYM
{
Lex->sql_command= SQLCOM_SELECT;
}
select_init2
| '(' select_paren ')' union_opt
;
/* Need select_init2 for subselects. */
union_select_init:
SELECT_SYM select_init2
| '(' select_paren ')' union_opt
;
...
union_opt:
/* Empty */ { $$= 0; }
| union_list { $$= 1; }
| union_order_or_limit { $$= 1; }
;