[PHP-DB] howto merge tables..

2003-08-22 Thread FB
Hi,

I have 3 similar tables. I want to merge them. The thing I use is

1) SELECT *
2) Make a while statement
3) INSERT each raw into the other table

is there a easier way?

FB




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] howto merge tables..

2003-08-22 Thread Sean Burlington
FB wrote:
Hi,

I have 3 similar tables. I want to merge them. The thing I use is

1) SELECT *
2) Make a while statement
3) INSERT each raw into the other table
is there a easier way?

FB
if the columsn are identical

insert into table1 select * from table2;
insert into table1 select * from table3;
if the column names are different

insert into table12 (colname1, calname2)  select colname3, colname4 from 
walks;

the above works on mysql ...

--

Sean

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] howto merge tables..

2003-08-22 Thread FB
that was preety good..

merged 3 tables with 2 million raws in 3 minutes...

thanks

FB

Sean Burlington [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 FB wrote:
  Hi,
 
  I have 3 similar tables. I want to merge them. The thing I use is
 
  1) SELECT *
  2) Make a while statement
  3) INSERT each raw into the other table
 
  is there a easier way?
 
  FB

 if the columsn are identical

 insert into table1 select * from table2;
 insert into table1 select * from table3;

 if the column names are different

 insert into table12 (colname1, calname2)  select colname3, colname4 from
 walks;

 the above works on mysql ...

 -- 

 Sean




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php