我正在试图更新mysql中的行,但是对于单值mysql查询,我必须使用for循环进行多个更新
update table set column1='100' where id =1
update table set column1='100' where id =6
update table set column1='100' where id =14我使用for循环以不同的id多次运行查询,我希望运行单个查询来更新所有行。这有可能吗?
我想做这样的事
update table set column1='100' where id=1,6,14;发布于 2015-01-16 06:38:47
使用IN()运算符
update table_name SET field_name='101'
where id IN(1,2,7,9) 发布于 2015-01-16 06:30:19
使用IN()
update table
set column1='100'
where id in (1,6,14)或OR
update table
set column1='100'
where id = 1 OR id = 6 OR id = 14https://stackoverflow.com/questions/27978426
复制相似问题