"Colt Brunton" <[EMAIL PROTECTED]> wrote:
> I am trying to adapt a query, (kindly) given by Rudy and I can't seem to
> debug it.
>
> Here is the query:
> CREATE TABLE Contact
> (SELECT
> ContactNo,
> Work_Address,
> Field20,
> Work_City,
> Work_State,
> Work_Zip,
> Work_Country
> FROM import
> UNION ALL
> SELECT
> ContactNo,
> Home_Address,
> Field26,
> Home_City,
> Home_State,
> Home_Zip,
> Home_Country
> FROM import
> WHERE Home_Address IS NOT NULL);
>
> CREATE TABLE ADDRESS
> (SELECT
> Work_Address,
> Field20,
> Work_City,
> Work_State,
> Work_Zip,
> Work_Country
> FROM import
> UNION ALL
> SELECT
> Home_Address,
> Field26,
> Home_City,
> Home_State,
> Home_Zip,
> Home_Country
> FROM import
> WHERE Home_Address IS NOT NULL);
>
> The error messages given by the MySQL Front are:
> You have an error in your SQL syntax near 'SELECT ContactNo,
> Work_Address, Field20, Work_City, Work_State, Work_Zip, Work_C' at line
> 1
> You have an error in your SQL syntax near 'SELECT Work_Address, Field20,
> Work_City, Work_State, Work_Zip, Work_Country FROM' at line 1
>
> These messages aren't very informative, is there a more informative way
> to debug queries?
Remove brackets, i.e.
CREATE TABLE Contact SELECT .. UNION ALL SELECT ... ;
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Victoria Reznichenko
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]