萧阳_0
2019-03-25 10:56
check the manual that corresponds to your MySQL server version for the right syntax to use near 'where item_id = 5 and stock >= 1' at line 3.
在销量增加中犯了同样的错误,一开始就认为是sql语句错了,结果就是这个逗号被直接忽略,在service层浪费了两个半钟。。。感谢啊,要是没你的提示还不知道要搞多久。
解决了,原来是没有删除
set stock = stock - #{amount},
这的逗号
### Error updating database. Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where item_id = 5 and stock >= 1' at line 3
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: update item_stock set stock = stock - 1, where item_id = 5 and stock >= 1
### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where item_id = 5 and stock >= 1' at line 3
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where item_id = 5 and stock >= 1' at line 3]
SpringBoot构建电商基础秒杀项目
49064 学习 · 954 问题
相似问题