Reputation: 35
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
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= ?;
Upvotes: 0
Views: 35
Reputation: 11749
SELECT BatchNo,
(SUM(raw_bat_sum.STOTS) + SUM(raw_bat_sum.STOTR))
AS Sum
FROM raw_bat_sum
GROUP BY raw_bat_sum.BatchNo;
Upvotes: 2