RE: [PHP-DB] Copy data from one mysql table to another?

2001-03-28 Thread Brian Hardwick

do something like -

1. make a third table indentical to table svt_members. lets call it
svt_members_temp.

2. load the svt_members_temp table with the merged values.

"Insert into svt_members_temp(key_svt_members, phone, etc,etc,etc)
Select phone.key_svt_members, phone.phone, svt_members.etc, svt_members.etc,
svt_members.etc
>From svt_members, phone
Where svt_members.key_svt_members = phone.key_svt_members"

3. cross your fingers (or backup)

4. empty the contents of the original table.
"delete from svt_members"

5. load the data back into the real table.

"Insert into svt_members(key_svt_members, phone, etc,etc,etc)
Select svt_members_temp(key_svt_members, phone, etc,etc,etc)"

- brian hardwick

-Original Message-
From: Bob Stone [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 3:54 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Copy data from one mysql table to another?


Dear PHP Helpers,

I cannot find any documentation on how to copy the
data from one mysql table to another, i.e. table1,
columnx to table2, columnx.

Can you recommend a way?

Here is the situation.

I have one table called "phone" with two columns. The
first column is called "key_svt_members," the second
is called "phone."

I have a second table called "svt_members." This table
has 17 columns including "key_svt_members" and
"phone." The phone column in this table is currently
empty.

I wish to copy the data that is in phone, phone into
svt_members.

Can you recommend a method?

Thanks in advance,

Bob Stone

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/?.refer=text

--
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]




Re: [PHP-DB] Copy data from one mysql table to another?

2001-03-28 Thread CC Zona

In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Bob Stone) wrote:

> I cannot find any documentation on how to copy the
> data from one mysql table to another, i.e. table1,
> columnx to table2, columnx.

See the mysql documentation of the "insert into" syntax for how to use a 
trailing "select" statement to get the values to be inserted.  In a single 
statement you can select the data from one table and insert it into 
another.  Example: "insert into table2 (p_key,data) select p_key,data from 
table1 where p_key >100 and data !='garbage'"

(This also works for "replace into" and "create table" statements, BTW.  
Nifty, eh? )

-- 
CC

-- 
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-DB] Copy data from one mysql table to another?

2001-03-28 Thread Bob Stone

Dear PHP Helpers,

I cannot find any documentation on how to copy the
data from one mysql table to another, i.e. table1,
columnx to table2, columnx.

Can you recommend a way?

Here is the situation.

I have one table called "phone" with two columns. The
first column is called "key_svt_members," the second
is called "phone."

I have a second table called "svt_members." This table
has 17 columns including "key_svt_members" and
"phone." The phone column in this table is currently
empty.

I wish to copy the data that is in phone, phone into
svt_members.

Can you recommend a method?

Thanks in advance,

Bob Stone

__
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/?.refer=text

-- 
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]