Is there any easy way to update all values after a duplicate key? For example:
INSERT INTO published_books
SELECT * FROM books
WHERE book_id = book_id
ON DUPLICATE KEY UPDATE ?everything?
The table has around 50 columns and updating each would be painful. Any ideas?
You can use REPLACE INTO
for this purpose:
REPLACE INTO published_books SELECT * from books;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With