Need my SQL to update on existing...

ok, it's simple, I have this sql statement, and I want it to update "ON DUPLICATE KEY"... the two tables are identical so the easiest is best :)

$sql = "INSERT lapa_backups.2_transaction_tmp SELECT * FROM 2_transaction";
rickconnerAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
have you already checked the document?
http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html

$sql = "INSERT lapa_backups.2_transaction_tmp SELECT * FROM 2_transaction ON DUPLICATE KEY UPDATE somefield = somevalue;";
0
 
Jinesh KamdarCommented:
Shouldn't that be an INSERT INTO lapa_backups.2_transaction_tmp ....
The INTO keyword is missing there.
0
All Courses

From novice to tech pro — start learning today.