你给的demo 用的是SQL Lite(活字格内置的数据库),你直接套到mysql数据库上肯定不能用
SELECT
[物料信息].[物料编号],
SUM([销售出货记录].[出货数量]) AS [销售数量]
FROM
[销售出货记录]
INNER JOIN
[销售订单详情] ON [销售出货记录].销售订单详情ID = [销售订单详情].ID
INNER JOIN
[客户产品信息] ON [销售订单详情].客户产品ID = [客户产品信息].ID
INNER JOIN
[物料信息] ON [客户产品信息].物料产品ID = [物料信息].物料编号
GROUP BY
[物料信息].[物料编号]; |