Hallo my friends.... I am writing a database application program with PHP and MySQL. I have two tables that I want to query in the same time with "SELECT...UNION SELECT ..." syntax. Too many errors encountered; the rest of the message is ignored: The 2 tables are APPOINTMENT table (APP) and SALESREPORT table (SR). The APPOINTMENT Table has these 8 columns : No_Appointment, SalesID, CustID, Date, Time, ToDo, Done, TimeStamp. And the SALESREPORT Table has these 4 columns : SalesID, CustID, Report, TimeStamp.
I want to display the information from these 2 tables in the same time, like this under below : SalesID CustID Status TimeStamp ---------------------------------- 1 1 Not Yet 20021111195428 ---> from APP 1 2 Not Yet 20021111200000 ---> from APP 2 3 TOL 20021111090010 ---> from SR ... ... ... ... ... ... ... ... I did so : " SELECT SalesID, CustID, Done AS Status, TimeStamp FROM Appointment Where Done='Not Yet' UNION SELECT SalesID, CustID, Report AS Status, TimeStamp FROM SalesReport WHERE Report LIKE 'TOL%' " I got this error message : " mysql> SELECT SalesID, CustID, Done AS Status, TimeStamp FROM Appointment Where Done='Not Yet' UNION SELECT SalesID, CustID, Report AS Status, TimeStamp FROM SalesReport WHERE Report LIKE 'TOL%'; ERROR 1064: You have an error in your SQL syntax near 'UNION SELECT SalesID, CustID, Report AS Status, TimeStamp FROM SalesReport WHERE' at line 1 mysql> " How should I do this select query ? Thank you very much in advance. __________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 --------------------------------------------------------------------- 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