If you are running version 4.1, you can use a sub-select.
INSERT INTO table2 SELECT table1
WHERE IDs IN (SELECT IDs FROM /* this may be the one with left joins */
table3)


Thanks
Emery
----- Original Message -----
From: "Nobody" <[EMAIL PROTECTED]>
To: "PAUL MENARD" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, October 10, 2003 14:40
Subject: Re: [MYSQL] Combine tables from two different systems


> Hi Paul
>
> If all the tables have a primary key set, you can do an INSERT IGNORE from
> the tables in System A to the tables in System B (either manually or write
a
> script).
> Any rows form System A that already have a System B equivalent will be
> silently dropped and only those that do not have an equivalent will be
> written.
>
> e.g. INSERT IGNORE INTO system_b.table_n (columns)
> SELECT columns FROM system_a.table_n
>
> HTH
> Rory McKinley
> Nebula Solutions
> 082 857 2391
> [EMAIL PROTECTED]
> "There are 10 kinds of people in this world,
> those who understand binary and those who don't" (Unknown)
> ----- Original Message -----
> From: "PAUL MENARD" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, October 09, 2003 5:21 PM
> Subject: [MYSQL] Combine tables from two different systems
>
>
> > Hello All,
> >
> > I have two system, we shall call then system A (OLD) and system B (NEW),
> running MySQL that I want to combine their tables. The system B is the
newer
> and most accurate. The table structure is the exact same. Some of the rows
> in system B (NEW) tables are also in system A (OLD). For those rows I want
> to leave the system B data unchanged.
> >
> > I have a select statement with a left join that will tell me the rows
that
> are in system A but not in system B (the target). Question is how to I
write
> a SQL statement to also insert these rows?
> >
> > System information.
> >
> > Windows NT4 (System A), Windows server 2003 (System B).
> > MySQL 3.23.42-nt running on both systems.
> >
> > Paul
> >
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>
>



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to