[ACCEPTED]-Update mysql table with data from another table-sql-update
Accepted answer
UPDATE table1 t1, table2 t2
SET t1.field_to_change = t2.field_with_data
WHERE t1.field1 = t2.field2;
0
UPDATE book_details AS bd, book_details_old AS old
SET bd.live=1
WHERE bd.isbn13=old.isbn13
AND old.live=1;
0
Just a litle change and you got it:
UPDATE book_details
SET live = 1
WHERE ISBN13 in (SELECT ISBN13 FROM book_details_old WHERE live = 1);
0
To update a table from data in other table
UPDATE table1, table2 SET table1.field1 = table2.field1 where table1.id = table2.id
EX.UPDATE transaction, member SET transaction.Memberid = member.memberId
WHERE transaction.CardId = member.CardId;
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.