javascript hit counter Web World: Copying the Contents of One Table to Another
Nikhil Sheth

Web World

This site is for php , mysql , flash,.... Inshort for any web related stuff

Monday, April 18, 2005

Copying the Contents of One Table to Another

How to copy the contents of one table to another using SQL is not immediately obvious.
Create and Populate Table

create table mytablecopy select * from originaltable

Copying a Table into an Existing Table

insert into originaltable select * from mytablecopy

Sub-Selects

MySQL doesn't yet support sub-selects. For example you cannot do this:

select * from things where thing.userid not in (select userid from
otherthings)

1 Comments:

Post a Comment

<< Home