使用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 ;    錯誤

 

修改字段值為當前時間

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM