[thelist] merging tables in mysql

Jonathan Karlen jkarlen at infoniq.com
Fri Aug 20 10:15:57 CDT 2004

Try doing it in two steps:

Create table clients (
	table def

Insert into clients
Select * from clients1
Select * from clients 2;

Jonathan R. Karlen
President/Senior Developer
Infoniq E-Business Solutions, Inc.

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Sarah Sweeney
Sent: Friday, August 20, 2004 10:18 AM
To: thelist
Subject: [thelist] merging tables in mysql

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:
     (SELECT * FROM Clients1
      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.


Sarah Sweeney  ::  Web Developer & Programmer
Portfolio  ::  http://sarah.designshift.com
Blog  ::  http://hardedge.ca
Family  ::  http://geekjock.ca

News! - Evolt.org conference for web professionals. 
17-19 September 2004 in Toronto, Canada. 
Details at http://TOevolt.org

* * Please support the community that supports you.  * *

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 

More information about the thelist mailing list