-
更新数据库中多个字段时要注意:
- (要更新的字段)set后的字段用
,
连接,where条件用and
连接。
UPDATE apply_check SET checked=1,result_tutor_no=20170002 WHERE stu_no=20171530 and tutorNo=20170000
- (要更新的字段)set后的字段用
-
mysql无法正确识别sql语句,会问题。
比如我这checked字段设置了不能为空,无法识别set后的更新字段,就报错了。
【报错】
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'checked' cannot be null