ORDERing two UNION queries: Non-Subquery UNION Execution
| From: | ioannes | Date: | Fri, 13 Apr 2007 16:48:11 +0000 |
| Subject: | ORDERing two UNION queries: Non-Subquery UNION Execution | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-43441@lists.php.net to get a copy of this message | ||
http://dev.mysql.com/doc/internals/en/select-union.html
Does anyone know what this means? Can it be implemented in the flow of php code without explicitly creating temp tables in the database?
My query is like:
$query = "
(SELECT
Table.field, [other fields]
FROM Table [other JOINs]
ORDER BY Table.field
)
UNION
(SELECT
Table2.field, [other fields]
FROM Table2 [other JOINs]
ORDER BY Table2.field
)
";
and I want the ORDER to apply to the whole UNIONed result.
John