Home > database >  The primary key and uniqueness, add or replace the record
The primary key and uniqueness, add or replace the record

Time:09-23


 REPLACE INTO t1 (` number `, ` name `) 
The SELECT ` number `, ` name ` FROM t2, t3, WHERE t2. Name=t3. The name
ON the DUPLICATE KEY UPDATE t1. Number=t2. Number;


Find the t2. Name and t3. The name of the same record, the record again insert or replace the t1, t1. The number is UNIQUE,
ON the DUPLICATE KEY UPDATE t1. Number=t2. Number; This is an error
  • Related