MySQL insert or update in one query
Posted October 29, 2007
on:Another MySQL timesaver:
INSERT INTO Sales(TransId, Status, Amount)
VALUES(123, 'Pending', 20)
ON DUPLICATE KEY UPDATE Status = 'Paid'
Via Particletree
————
Need to improve your MySQL skills? I recommend:
High Performance MySQL: Optimization, Backups, Replication, and More
Leave a comment