使用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 ;    错误

 

修改字段值为当前时间

update table set time1=now(),time2=now();

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-31
  • 2021-07-18
  • 2022-12-23
  • 2022-02-14
  • 2021-09-07
  • 2022-02-09
猜你喜欢
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案