create table test(
id int not null primary key,
num int not null UNIQUE key,
tid int not null
)
id | num | tid |
---|---|---|
1 | 2 | 3 |
2 | 3 | 3 |
insert into test(`id`, `num`, `tid`) values(1,2,3),(2,3,3) on duplicate key update `id`= VALUES(id) AND `num`= VALUES(num) AND `tid` = VALUES(tid) + 1;
1062 - Duplicate entry '0' for key 'PRIMARY'
时间: 0.001s
How to fix it?
?,为什么总有人把这种update/set语法都搞错,update table set A=X,B=X where ..; 不是什么set A=X and B=X .. 这里的on duplicate key update后面也是一样。。。 不能用and。。。