SSM插入时Column count doesn t match value count at row 1
时间: 2023-10-12 08:01:38 浏览: 122
demo.zip_Mybatis注解时的sql语句拼接方法_SSM 注解_SSM分页查询_mybatis注解分页_基于ssm
出现"Column count doesn't match value count at row 1"错误通常是由于插入语句中列的数量与值的数量不匹配导致的。根据你提供的引用内容,可能有几个可能的原因导致此错误。
首先,你提到使用了foreach标签进行数据插入,并将两条数据作为一行进行插入。然而,你的foreach标签翻译成的SQL语句中,值的顺序是不正确的,导致列的数量与值的数量不匹配。正确的语法应该是每个值对应一组括号,例如values (值1-1, 值1-2, ...), (值2-1, 值2-2, ...)。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [SpringBoot整合mybatis问题Column count doesn‘t match value count at row 1](https://blog.csdn.net/weixin_45551504/article/details/108484213)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* [java.sql.SQLException: Column count doesn't match value count at row 1](https://blog.csdn.net/Greek_to_me/article/details/80218076)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文