MySQL的upsert

 

 

 insert into websites
(id,name,url)
VALUES
(1,'csdn','blog.csdn.net')
ON DUPLICATE KEY UPDATE
id=1,name='csdn',url='blog.csdn.net'

批量

insert into websites
(id,name,url)
VALUES
(1,'csdn','blog.csdn.net')
ON DUPLICATE KEY UPDATE
id=values(id);

你可能感兴趣的:(mysql)