update data from other table
Hi, How to update data in table with data from other table in single SQL command (without using loop)? Sommai, -- Please be informed that all e-mail which are addressing to thaithanakit.co.th will need to be changed to BTsecurities.com by March 1, 2002 Thank you. :-) -- - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: update data from other table
Soory its not possible. Here a User Comment from the Commented MySqlDoc (Chapter UPDATE Systax) -- Comments: Michael Holopainen: I was looking for info on how-to UPDATE with data retrived from another table. aka. UPDATE with JOIN. I noticed many other people were asking the same question so I desided to write this comment. The answer is : You can't. Not until MySQL 4.1 that supports sub-selects. Then and only then you can use something like this: UPDATE t1 SET t1.col = (SELECT t2.col FROM t2 WHERE where clause) WHERE where clause; As far as I can tell not even in MySQL 4.1 can you use JOIN with UPDATE. - Original Message: - From: Sommai Fongnamthip [EMAIL PROTECTED] Date: Fri, 15 Feb 2002 16:37:51 +0700 To: [EMAIL PROTECTED] Subject: update data from other table Hi, How to update data in table with data from other table in single SQL command (without using loop)? Sommai, -- Please be informed that all e-mail which are addressing to thaithanakit.co.th will need to be changed to BTsecurities.com by March 1, 2002 Thank you. :-) -- - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php mail2web - Check your email from the web at http://mail2web.com/ . - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: update data from other table
Sorry its not possible. Here a User Comment from the commented MySql Doc (Chapter UPDATE Systax) -- Comments: Michael Holopainen: I was looking for info on how-to UPDATE with data retrived from another table. aka. UPDATE with JOIN. I noticed many other people were asking the same question so I desided to write this comment. The answer is : You can't. Not until MySQL 4.1 that supports sub-selects. Then and only then you can use something like this: UPDATE t1 SET t1.col = (SELECT t2.col FROM t2 WHERE where clause) WHERE where clause; As far as I can tell not even in MySQL 4.1 can you use JOIN with UPDATE. - Original Message: - From: Sommai Fongnamthip [EMAIL PROTECTED] Date: Fri, 15 Feb 2002 16:37:51 +0700 To: [EMAIL PROTECTED] Subject: update data from other table Hi, How to update data in table with data from other table in single SQL command (without using loop)? Sommai, -- Please be informed that all e-mail which are addressing to thaithanakit.co.th will need to be changed to BTsecurities.com by March 1, 2002 Thank you. :-) -- - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php mail2web - Check your email from the web at http://mail2web.com/ . - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: update data from other table
HI Hi, How to update data in table with data from other table in single SQL command (without using loop)? Sommai, insert into table1 select * from table2 Kittiphum Worachat,MT. www.hatyailab.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: update data from other table
I want to update existing data not insert new data. sommai At 16:52 15/2/2002 +0700, Kittiphum Worachat wrote: HI Hi, How to update data in table with data from other table in single SQL command (without using loop)? Sommai, insert into table1 select * from table2 Kittiphum Worachat,MT. www.hatyailab.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- Please be informed that all e-mail which are addressing to thaithanakit.co.th will need to be changed to BTsecurities.com by March 1, 2002 Thank you. :-) -- - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: update data from other table
thank you very much. I have to used loop for this solution, did I? sommai At 04:53 15/2/2002 -0500, [EMAIL PROTECTED] wrote: Sorry its not possible. Here a User Comment from the commented MySql Doc (Chapter UPDATE Systax) -- Comments: Michael Holopainen: I was looking for info on how-to UPDATE with data retrived from another table. aka. UPDATE with JOIN. I noticed many other people were asking the same question so I desided to write this comment. The answer is : You can't. Not until MySQL 4.1 that supports sub-selects. Then and only then you can use something like this: UPDATE t1 SET t1.col = (SELECT t2.col FROM t2 WHERE where clause) WHERE where clause; As far as I can tell not even in MySQL 4.1 can you use JOIN with UPDATE. - Original Message: - From: Sommai Fongnamthip [EMAIL PROTECTED] Date: Fri, 15 Feb 2002 16:37:51 +0700 To: [EMAIL PROTECTED] Subject: update data from other table Hi, How to update data in table with data from other table in single SQL command (without using loop)? Sommai, -- Please be informed that all e-mail which are addressing to thaithanakit.co.th will need to be changed to BTsecurities.com by March 1, 2002 Thank you. :-) -- - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php mail2web - Check your email from the web at http://mail2web.com/ . - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- Please be informed that all e-mail which are addressing to thaithanakit.co.th will need to be changed to BTsecurities.com by March 1, 2002 Thank you. :-) -- - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: update data from other table
Hi. Try to use replace if you have unique key index and both table have the same structure: and query like, replace into tableA select * from tableB Kittiphum Worachat,MT. www.hatyailab.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php