select C.GZ_YM AS 缴费年月, C.C21163 AS 养老保险单位缴纳, C.C2144 AS 养老保险个人缴纳, SUM(C.C21163+C.C2144) AS 养老合计, C.C21165 AS 失业保险单位缴纳, C.C2153 AS 失业保险个人缴纳, SUM(C.C21165+ C.C2153) AS 失业合计, C.C21166 AS 工伤保险单位缴纳, C. C21164 AS 医疗保险单位缴纳, C.C2147 AS 医疗保险个人缴纳, SUM( C.C21164+C.C2147) AS 医疗合计, SUM(C.C21163+C.C21165+ C. C21164+ C.C21166) AS 单位缴纳总合计, SUM(C.C2144+C.C2153+C.C2147) AS 个人缴纳总合计, SUM(C.C21163+C.C21165+ C. C21164+ C.C21166+C.C2144+C.C2153+C.C2147) AS 总合计 FROM C21 C LEFT JOIN b01 on c21.dept_id - b01.dept_id加GROPBY
时间: 2024-04-17 16:24:12 浏览: 81
您的查询语句有一个小错误,"加GROPBY" 应该是 "GROUP BY"。下面是修正后的查询语句:
```sql
SELECT
C.GZ_YM AS 缴费年月,
C.C21163 AS 养老保险单位缴纳,
C.C2144 AS 养老保险个人缴纳,
SUM(C.C21163+C.C2144) AS 养老合计,
C.C21165 AS 失业保险单位缴纳,
C.C2153 AS 失业保险个人缴纳,
SUM(C.C21165+ C.C2153) AS 失业合计,
C.C21166 AS 工伤保险单位缴纳,
C.C21164 AS 医疗保险单位缴纳,
C.C2147 AS 医疗保险个人缴纳,
SUM(C.C21164+C.C2147) AS 医疗合计,
SUM(C.C21163+C.C21165+ C.C21164+ C.C21166) AS 单位缴纳总合计,
SUM(C.C2144+C.C2153+C.C2147) AS 个人缴纳总合计,
SUM(C.C21163+C.C21165+ C.C21164+ C.C21166+C.C2144+C.C2153+C.C2147) AS 总合计
FROM C21 C
LEFT JOIN b01 ON c21.dept_id = b01.dept_id
GROUP BY C.GZ_YM
```
请注意,我修正了左连接的 ON 子句,将 "c21.dept_id - b01.dept_id" 改为了 "c21.dept_id = b01.dept_id"。同时,我将 "加GROPBY" 修改为了 "GROUP BY"。
阅读全文