469,106 Members | 2,135 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,106 developers. It's quick & easy.

copy data from one table to another

I want to retrieve all records from one table and insert them into
another table. Can this be done in one statement? I appreciate if
anyone out there can help me out. Thanks in advance!

Alex Shi
Jul 20 '05 #1
2 14337
"Alex Shi" <ch****@stonix.com> wrote in message
I want to retrieve all records from one table and insert them into
another table. Can this be done in one statement? I appreciate if
anyone out there can help me out. Thanks in advance!


insert into table (a, b, c)
select a, b, c
from ...

The above is ANSI compliant. Note the like keyword in MySql, which lets you
select *

create table dest like source;
insert into dest
select * from source;
Jul 20 '05 #2
"Siemel Naran" <Si*********@REMOVE.att.net> wrote in message news:<FM*********************@bgtnsc04-news.ops.worldnet.att.net>...
"Alex Shi" <ch****@stonix.com> wrote in message
I want to retrieve all records from one table and insert them into
another table. Can this be done in one statement? I appreciate if
anyone out there can help me out. Thanks in advance!


insert into table (a, b, c)
select a, b, c
from ...

The above is ANSI compliant. Note the like keyword in MySql, which lets you
select *

create table dest like source;
insert into dest
select * from source;


It works! thanks!

Alex
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Peter CCH | last post: by
3 posts views Thread by david | last post: by
7 posts views Thread by lgbjr | last post: by
5 posts views Thread by Clodoaldo Pinto Neto | last post: by
6 posts views Thread by sql_server_user | last post: by
4 posts views Thread by JIM.H. | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.