I have a query of the form: (SELECT A, B from X ORDER BY A LIMIT 1000) UNION ALL (SELECT A, B from Y ORDER BY A LIMIT 1000) ORDER BY A
I thought may be each query needs to start with SELECT, so I wrapped the above query in a derived-table expression like: SELECT * FROM ( (SELECT A, B from X ORDER BY A LIMIT 1000) UNION ALL (SELECT A, B from Y ORDER BY A LIMIT 1000) ORDER BY A ) as MyAlias But MySQL refuses to execute it and gave me this error: Error Code : 1248 Every derived table must have its own alias Now when I gave each SELECT part of the UNION query its own alias, as the above error message suggests, MySQL still won't execute it and gave me a syntax error. Is there a way to force MySQL to cache the above query, or at least fool it into caching it? Thanks, Homam -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]