有三个表,以炉次表中炉次字段为一列,对sheet1、 sheet2中以炉次为单位对重量进行汇总,下列SQL为啥不对?请修改。请教了。
SELECT a.炉次1, sum(a.重量1) AS 重量之总计1, Sum(a.重量2) AS 重量之总计2
FROM (select 炉次, as 炉次1
from 炉次
UNION ALL SELECT 重量1, 炉次,
where 炉次=炉次1,
from sheet1
UNION ALL SELECT 重量2, 炉次,
where 炉次=炉次1
from sheet2) AS a
GROUP BY a.炉次1;