`

mysql insert ... on duplicate key update

阅读更多

表结构

c,d,e  三个字段为组合唯一索引

 

实现:

         如果库中存ced确定的唯一记录则则更新 ,不存在则插入

sql:

 insert into  table  (a,b,c,d,e) values ('a','b','c','d','e') on duplicate key update a=values(a),b=values(b)

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics