Office中国论坛/Access中国论坛

标题: 请都多数求和汇总! [打印本页]

作者: zhenghai0504    时间: 2009-10-24 16:51
标题: 请都多数求和汇总!
有三个表,以炉次表中炉次字段为一列,对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;




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3