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)

猜你喜欢

转载自llljyblll.iteye.com/blog/2257362