Rule is simple:

udpate table_name set  destination_column=source_column

If you want to update multiple tables and you can join on that table you can use the join syntax also in the UPDATE:

UPDATE items,month SET items.price=month.price WHERE items.id=month.id;

OR

UPDATE TABLE_1 LEFT JOIN TABLE_2 ON TABLE_1.COLUMN_1= TABLE_2.COLUMN_2 SET TABLE_1.COLUMN = EXPR WHERE TABLE_2.COLUMN2 IS NULL

So to copy data from one field to another mysql mulitple rows.

UPDATE agreement a1 
       JOIN agreementtemp a2 
         ON a1.id = a2.id 
SET    a1._date2 = Concat(SUBSTRING(a2._date, 7), '-', SUBSTRING(a2._date, 4, 2) 
                   , '-', 
                                      SUBSTRING(a2._date, 1, 2));

Enjoy!

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

16 + 17 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.

You May Also Like