Hi, On Wed, Mar 19, 2003 at 03:11:38PM -0800, Mike Lemke wrote: > Hello MySQL Guru's- > This is regarding UNION support in MySQL 4.0.12. >
Never used it, but ... > The query below is attempting to return rows that can > be easily parsed for the purposes of creating XML. > The ORDER BY is not being processed properly at the > end of the query. Sample scripts are shown below, to > setup the DB and test the query. > ... Did you try it with braces as explained in the UNION documentation? http://www.mysql.com/doc/en/UNION.html Your query would then be: (SELECT 1 AS Tag, NULL AS Parent, Users.UserId AS 'User!1!UserID!hide', Users.FirstName AS 'User!1!FirstName', Users.LastName AS 'User!1!LastName', NULL AS 'Cars!2!CarID!hide', NULL AS 'Cars!2!Details', NULL AS 'Trips!3!TripID!hide', NULL AS 'Trips!3!Mileage' FROM Users WHERE Users.UserId='2') UNION ALL (SELECT 2, 1, Users.UserId, NULL, NULL, Cars.CarID, Cars.Details, NULL, NULL FROM Cars INNER JOIN Users ON Cars.UserID = Users.UserID WHERE Users.UserId='2') UNION ALL (SELECT 3, 2, Users.UserId, NULL, NULL, Cars.CarID, NULL, Trips.TripID, Trips.Mileage FROM Trips INNER JOIN Cars ON Trips.CarID = Cars.CarID INNER JOIN Users ON Cars.UserID = Users.UserID WHERE Users.UserId='2') ORDER BY 'Cars!2!CarID!hide', 'User!1!UserID!hide', Tag ; Regards, Fred. -- Fred van Engen XB Networks B.V. email: [EMAIL PROTECTED] Televisieweg 2 tel: +31 36 5462400 1322 AC Almere fax: +31 36 5462424 The Netherlands --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php