MySQL 数据库 批量更新语句
update crosssortingsystem set
`Value` = CASE `Code` when 'LatticeInfo' then '202' else `Value` END,
UpdateTime = CASE `Code` when 'LatticeInfo' then DATE_FORMAT(NOW(),"%y-%m-%d") else UpdateTime END
where FloorNo = 1 ;
#主键判断法,任意字段可为主键,当主键存在时更新指定字段
insert into biaoName(column1,column2,column3...) value(1,1,”张三”...)
on duplicate key update
column2= 2,
column3=”张三”;
#主键判断法,任意字段可为主键,当主键存在时删除对应行,重新插入
#可以有多个主键,可以插入多条,多个主键仅当存在所有主键都重复时更新,否则插入
REPLACE into statisticstbl_user
(UpCount,UserCode,OperateDate,UpdateTime)
VALUES
(2800,"us1","2021-02-19","2021-02-19 00:21:00") ,
(2200,"us2","2021-02-19","2021-02-19 00:32:01")