1
julyclyde 2016-12-20 21:23:47 +08:00
insert ignore?
|
2
billlee 2016-12-20 21:49:09 +08:00
那你为什么用 REPLACE 干嘛,用 INSERT
|
3
li24361 2016-12-20 21:59:55 +08:00
ON DUPLICATE KEY UPDATE
|
4
inaho 2016-12-20 22:01:58 +08:00
楼上+1 , 加个唯一索引
|
5
TaMud 2016-12-20 22:17:05 +08:00
1 、唯一索引
2 、 WHERE NOT EXISTS |
6
darrenfang 2016-12-21 07:47:21 +08:00 via iPhone
insert ignore
|
7
wwulfric 2016-12-21 10:39:36 +08:00
唯一索引会报错啊
|
8
Zuckonit 2016-12-21 11:02:31 +08:00
1. mysql
2. unique index 3. ON DUPLICATE KEY UPDATE / INSERT IGNORE |
9
anthow 2016-12-21 11:48:47 +08:00
merge into ... when not matched then insert...
|
10
ihuotui 2016-12-21 12:03:52 +08:00
捕获唯一索引的错误,然后变为更新操作啊。
|
11
rekulas 2016-12-21 23:01:56 +08:00
insert into table1(a,b,c) select v1,v2,v3 from dual where not exists (select * from table1 where a='a')
这样也可以无重复插入 |