[英]SQL Query - finding multiple sums with a row
I need some help trying to find out how I can make this SQL Query try and find the total sums for all unique BatchNo's 我需要一些帮助来尝试找出如何使此SQL查询尝试并查找所有唯一BatchNo的总和
something like this: 像这样的东西:
|BatchNo| Sum |
1 20
2 45
3 22
this is what i have right now. 这就是我现在所拥有的。
SELECT BatchNo,
SUM(raw_bat_sum.STOTS + raw_bat_sum.STOTR)
AS Sum
FROM raw_bat_sum
WHERE raw_bat_sum.BatchNo= ?;
SELECT BatchNo,
(SUM(raw_bat_sum.STOTS) + SUM(raw_bat_sum.STOTR))
AS Sum
FROM raw_bat_sum
GROUP BY raw_bat_sum.BatchNo;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.