使用SQL中的update更新多个字段值

使用SQL中的update更新多个字段值,set后面的条件要用逗号不能用and

set后面的多个条件之间没有关联也不可以有关联,所以就不能用and了;where 条件后面 可以为and

如:

update table set sex= '男', name='张三' where id = 1 ;          正确

update table set sex= '男' and name='张三' where id = 1 ;    错误

 

转自:

使用SQL中的update更新多个字段值 - 开心萌小小 - 博客园 (cnblogs.com)

 

posted @ 2023-06-08 09:26  信铁寒胜  阅读(624)  评论(0编辑  收藏  举报