I have this Stored Procedure that I converted from an Access Query that is not returning the correct result.
The SumOfWt_Add is retuning incorrect result.
For example if Bales_Add for a particular Row is 0 and the Avg_Bales_Wt is 1200 then result I get is 0. It should be 0.6.
CREATE PROCEDURE dbo.procStartup_Query
AS
SET NOCOUNT ON
SELECT Row, Furnish, MAX(dtDate) AS dtDate, SUM(Bales_Add) AS SumOfBales_Add, SUM(Bales_Remove) AS SumOfBales_Remove,
SUM(Bales_Add * Avg_Bale_Wt) / 2000 AS SumofWt_Add
FROM dbo.Main_Table
GROUP BY Row, Furnish
ORDER BY MAX(dtDate) DESC
SET NOCOUNT OFF
GO
Any help will be greatly appreciated.
Thank you
The SumOfWt_Add is retuning incorrect result.
For example if Bales_Add for a particular Row is 0 and the Avg_Bales_Wt is 1200 then result I get is 0. It should be 0.6.
CREATE PROCEDURE dbo.procStartup_Query
AS
SET NOCOUNT ON
SELECT Row, Furnish, MAX(dtDate) AS dtDate, SUM(Bales_Add) AS SumOfBales_Add, SUM(Bales_Remove) AS SumOfBales_Remove,
SUM(Bales_Add * Avg_Bale_Wt) / 2000 AS SumofWt_Add
FROM dbo.Main_Table
GROUP BY Row, Furnish
ORDER BY MAX(dtDate) DESC
SET NOCOUNT OFF
GO
Any help will be greatly appreciated.
Thank you