Home > Computers > Databases > SQL > SqlCopyColumn | About

UPDATE db1.table1 JOIN db2.table2
ON db1.table1.field = db2.table2.field
SET db1.table1.field = db2.table2.field

Concrete example : I am reinstalling a mail server and I need passwords from the old, clumsy, ISPConfig install to copy to my new, small, neat table :

mysql> 
UPDATE users JOIN dbispconfig.mail_user 
ON     users.email = dbispconfig.mail_user.email 
SET    users.password = dbispconfig.mail_user.password
;
Query OK, 21 rows affected (0.05 sec)
Rows matched: 442  Changed: 21  Warnings: 0
mysql> 

contact : @ychaouche yacinechaouche at yahoocom


QR Code
QR Code sqlcopycolumn (generated for current page)