I am doing SQL Server query calculations and the division always gives me zero.
SUM(sl.LINES_ORDERED)
, SUM(sl.LINES_CONFIRMED)
, SUM(sl.LINES_CONFIRMED) /
The two problems are that you
SUM returns an integer), andThis is how you could fix it (note that LINES_ORDERED and LINES_CONFIRMED are swapped):
SUM(sl.LINES_ORDERED)
, SUM(sl.LINES_CONFIRMED)
, (1.0*SUM(sl.LINES_ORDERED)) / SUM(sl.LINES_CONFIRMED) AS 'Percent'