如何通过sql更新多个值 [英] how to update more than one values through sql
本文介绍了如何通过sql更新多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的
i想要更新多个名称栏的值...
like
table1
id name
1 a
2 b
3 c
4 d
5 e
6 f
7 g
8 h
9 k
i想要更新id 1,4的名字,6,9
dear
i want to update more than one values of name column ...
like
table1
id name
1 a
2 b
3 c
4 d
5 e
6 f
7 g
8 h
9 k
i want to update name of id 1,4,6,9
推荐答案
检查这个
Hi ,
Check this
update table1
set
name= 'test'
where
ID in (1,3,5)
最好的问候
M.Mitwalli
Best Regards
M.Mitwalli
Update t
SET Name = Case When name = 'a' then yy
When Id = 'b' then zz
......
End
FROM <mytable> t
WHERE id IN (1,2,5,9)
Update table1 set name = ''newName1'' where id = 1;
Update table1 set name = ''newName3'' where id = 3;
Update table1 set name = ''newName7'' where id = 7;
这篇关于如何通过sql更新多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文