Saturday, September 08, 2012

MySQL : Insert from another DB with condition


Ref. http://stackoverflow.com/questions/10438464/how-do-i-copy-data-from-one-table-to-another-with-where-clause


DB1.TABLE1id value_name number
DB2.TABLE2id name value rid


insert into `DB1`.`TABLE1` (value_name)
SELECT name
FROM `DB2`.`TABLE2`

No comments:

Post a Comment