# 错误：sql：期望2个参数，实际有3个

- **ID:** `go/database-sql-query-arg-mismatch`
- **领域:** go
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

SQL 查询中的占位符数量与传给 Query 或 Exec 的参数数量不匹配。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.20 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Ensure the number of placeholders matches the number of arguments exactly.
   ```
2. **** (90% 成功率)
   ```
   Use named parameters with sql.Named to avoid count mismatches.
   ```

## 无效尝试

- **** — This changes the query logic and may cause unintended results or errors. (80% 失败率)
- **** — The query will not execute, and subsequent operations may fail. (90% 失败率)
