From: "Anders Karlsson" <[EMAIL PROTECTED]> > And by the way, in a UNION, there is no need to put parenteses around > the unioned queries in the general case. So > (SELECT .....) UNION (SELECT....) [ORDER BY ....] > Is the same as > SELECT ..... UNION SELECT.... [ORDER BY ....] > I say in the general case, as there are cases when the parenteses are > required, in particular when the individual > SELECT is followed by a MySQL specific construct or keyword. If I > remember things correctly for example, > this > (SELECT .... ORDER BY...) UNION (SELECT... ORDER BY...) [ORDER BY ....] > will require the parenteseses, but this construct is a MySQL extension > to the standard (an ORDER BY
SELECT ..... UNION SELECT.... [ORDER BY ....] is actually ambiguous IMHO. Is the last (optional) ORDER BY part of the SELECT or the UNION? Maybe that's why a (SELECT...) ORDER BY... is interpreted as a UNION (without the UNION keyword). Anyway, this behaviour is not documented, so I wouldn't rely on it. Also, I can't see the point of using it in any real life situation, so let's move on with more urgent matters: weekend ;-) Regards, Jigal. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]