分块查询 标签归档 - 永夜 没有不值得去解决的问题,也没有不值得去学习的技术! Sat, 01 Aug 2026 04:43:05 +0000 zh-Hans hourly 1 https://wordpress.org/?v=7.1.4 https://media.shuijingwanwq.com/2026/05/logo-150x150.png 分块查询 标签归档 - 永夜 32 32 在 Laravel 9 中,基于 chunkById 分块查询时报错:SQLSTATE[23000]: Integrity constraint violation: 1052 Column ‘id’ in where clause is ambiguous https://www.shuijingwanwq.com/2024/07/27/8730/ Sat, 27 Jul 2024 01:39:37 +0000 https://www.shuijingwanwq.com/?p=8730 文章记录了在 Laravel 9 中使用 chunkById 分块查询时遇到的 SQL 歧义报错问题。该错误提示 where 子句中的 id 列不明确。在尝试添加 column 参数后,虽然解决了歧义,却因为列不存在导致操作中止。最终通过同时添加 alias 参数,解决了报错并生成了符合预期的 SQL 语句。

在 Laravel 9 中,基于 chunkById 分块查询时报错:SQLSTATE[23000]: Integrity constraint violation: 1052 Column ‘id’ in where clause is ambiguous最先出现在永夜。

]]>