[thelist] merging tables in mysql
Sarah Sweeney
mr.sanders at designshift.com
Fri Aug 20 09:17:49 CDT 2004
I'm working on a project building a Contact Management System which
will, in effect, merge two existing systems. I've done a bunch of work
with the databases (SQL Server and Access) to merge them into one
(MySQL). Basically, what I've got now are two copies of each table, now
sharing the exact same structure. I just need to be able to merge the
copies into one single table. I tried this:
CREATE TABLE Clients AS
(SELECT * FROM Clients1
UNION
SELECT * FROM Clients2)
but I got a syntax error:
ERROR 1064: You have an error in your SQL syntax. Check the manual
that corresponds to your MySQL server version for the right syntax to
use near 'UNION
SELECT * FROM Clients2)' at line 3
However, if I run the SELECT statement all by itself, it works fine. I
assume this means that my UNION is not allowed in this instance. Any
ideas on how I can merge my tables?
BTW, I am using MySQL version 4.0.16-standard.
TIA
--
Sarah Sweeney :: Web Developer & Programmer
Portfolio :: http://sarah.designshift.com
Blog :: http://hardedge.ca
Family :: http://geekjock.ca
More information about the thelist
mailing list