mysql 批量更新语句 INSERT ON DUPLICATE KEY UPDATE

INSERT INTO t_agent(agent_ip,cs_no,hw_ver,agent_id) VALUES('192.168.1.1','4.1.1.4','11111',35) ON DUPLICATE KEY  UPDATE agent_id = VALUES(agent_id),cs_no = values(cs_no),agent_ip = values(agent_ip),hw_ver = values(hw_ver),cs_no = values(cs_no)  	
 
  



insert into
    Shops(shopid, viewtotal)  
values (1,123456),  
(2, 234567), 
(3, 345678) 
on duplicate key update
   shopid = values (shopid), 
   viewtotal = values (viewtotal)

你可能感兴趣的:(DB)