I'm trying to use T-SQL to return the relative percentage of two summed values when I divide the values into each other, but I always get 0. Here's an example of the type of calculation I'm trying:
SELECT
((SUM(Parts.Scrap) / SUM(Parts.Produced))*100)
AS Per_Scrap
FROM
Parts
Both the Scrap and Produced columns are defined as int data types in the Parts table. My calculation behaves almost as if the division operation is doing integer math. What am I doing wrong?
...