I have the following:SELECT isnull (Sum((Convert(numeric(8,2), (S.FinishLength/12) * T.FootWeight) / 2000)),0) AS Tons,isnull(Sum(case when S.RepairCode like '%A%' then(Convert(numeric(8,2), (S.FinishLength/12) * T.FootWeight) / 2000)end),0) AS A_Tons,-- Here is where I need (A_Tons / Tons) as A_PercentFROM NYS2Reheat R INNER JOIN NYS2SawPieces S ON R.RecordID = S.RollRecID INNER JOIN TensileProducts T ON R.FinalProd = T.SQLProductWhere S.ShiftIdent like '" & day1 & "254B' and S.Scrapped = 'N'
I need to divide A_Tons by Tons to get a percentage, but when Tons = 0 then I get a division by zero error.How can I "work-around" that?Obfuscated beyond repair.