The CREATE TABLE .. FROM ... SQL will do what you require, but I don't
think this is included in MySQL (one to check)...however if performance is
becoming an issue, ,then you may want to consider migrating to a different
DBMS (mySQL is not so good at handling large record sets, and has a much
cut-down set of SQL sytanx).

Sticking with mysql however, if it was a once off move that needed to take
place (which is what it sounds like) then it wouldn't be hard to write a
simple agent .. somethi like

1. select all records in the original table 
2. Loop through all the records (rows)
  2.1. extract the fields from the currently selected row
  2.2. INSERT this into your new table
  2.3 go onto the next row
3. Once all are done, drop the unwanted columns from your old table

Inelegant ,yes, but it will work! If you want more help, contact me OL

Tom

On Sun, 4 Feb 2001, phobo wrote:

> I am in the process of improving a database scheme considerably in MySQL, by
> breaking tables into smaller tables and so one. I am wondering if there is a
> simple SQL statement to take ALL ROWS of fields 'f1', 'f2', 'f3', and copy
> them to the another table.... Then I can remove the fields in the original
> table.
> 
> eg something like
> INSERT INTO BetterSmallerTable SET (PrimKey,Red,Green,Blue) VALUES (SELECT
> PrimKey,Red,Green,Blue FROM BigClumsyTable) ??
> 
> Thanks,
> Siggy
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to